Skip to main content

Open source Python library converting pdf to docx.

Project description

English | 中文

pdf2docx-headless

python-version pypi-version license pypi-downloads

  • Extract data from PDF with PyMuPDF, e.g. text, images and drawings
  • Parse layout with rule, e.g. sections, paragraphs, images and tables
  • Generate docx with python-docx

Difference to original pdf2docx

Important: This package is a fork of the original package, using opencv-python-headless as dependency instead of opencv-python to remove any gui dependencies.

Reference issue

Features

  • Parse and re-create page layout

    • page margin
    • section and column (1 or 2 columns only)
    • page header and footer [TODO]
  • Parse and re-create paragraph

    • OCR text [TODO]
    • text in horizontal/vertical direction: from left to right, from bottom to top
    • font style, e.g. font name, size, weight, italic and color
    • text format, e.g. highlight, underline, strike-through
    • list style [TODO]
    • external hyper link
    • paragraph horizontal alignment (left/right/center/justify) and vertical spacing
  • Parse and re-create image

    • in-line image
    • image in Gray/RGB/CMYK mode
    • transparent image
    • floating image, i.e. picture behind text
  • Parse and re-create table

    • border style, e.g. width, color
    • shading style, i.e. background color
    • merged cells
    • vertical direction cell
    • table with partly hidden borders
    • nested tables
  • Parsing pages with multi-processing

It can also be used as a tool to extract table contents since both table content and format/style is parsed.

Limitations

  • Text-based PDF file
  • Left to right language
  • Normal reading direction, no word transformation / rotation
  • Rule-based method can't 100% convert the PDF layout

Documentation

Sample

sample_compare.png

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pdf2docx-headless-0.5.8.tar.gz (3.1 MB view details)

Uploaded Source

Built Distribution

pdf2docx_headless-0.5.8-py3-none-any.whl (129.0 kB view details)

Uploaded Python 3

File details

Details for the file pdf2docx-headless-0.5.8.tar.gz.

File metadata

  • Download URL: pdf2docx-headless-0.5.8.tar.gz
  • Upload date:
  • Size: 3.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for pdf2docx-headless-0.5.8.tar.gz
Algorithm Hash digest
SHA256 ce7f499a6bad84543f6c37e18668d11b1b413bc0866d37f037196cf5383e70df
MD5 8db039ef6cf30419add126fa07a8ed65
BLAKE2b-256 252d8eb130ef597fdd141e2c7df6bb54f5396e59451cc32b66c773f76ec34263

See more details on using hashes here.

File details

Details for the file pdf2docx_headless-0.5.8-py3-none-any.whl.

File metadata

File hashes

Hashes for pdf2docx_headless-0.5.8-py3-none-any.whl
Algorithm Hash digest
SHA256 1e471d78f0e7e34b4527f74393189a13335c254858f4258c939eec3689ad7522
MD5 0baf3b538647755a8fc8667856c2743b
BLAKE2b-256 da51da326bf6ec481c63e8c23de31f5b04dfc20ae1337d5177b41d9eb988d12e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page