Open source Python library converting pdf to docx.
Project description
English | 中文
pdf2docx-headless
- 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.
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce7f499a6bad84543f6c37e18668d11b1b413bc0866d37f037196cf5383e70df |
|
MD5 | 8db039ef6cf30419add126fa07a8ed65 |
|
BLAKE2b-256 | 252d8eb130ef597fdd141e2c7df6bb54f5396e59451cc32b66c773f76ec34263 |
File details
Details for the file pdf2docx_headless-0.5.8-py3-none-any.whl
.
File metadata
- Download URL: pdf2docx_headless-0.5.8-py3-none-any.whl
- Upload date:
- Size: 129.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e471d78f0e7e34b4527f74393189a13335c254858f4258c939eec3689ad7522 |
|
MD5 | 0baf3b538647755a8fc8667856c2743b |
|
BLAKE2b-256 | da51da326bf6ec481c63e8c23de31f5b04dfc20ae1337d5177b41d9eb988d12e |