Skip to main content

Python library and CLI for converting PDF files to DOCX.

Project description

docx-from-pdf

A Python library and CLI for converting PDF files into editable DOCX documents.

docx-from-pdf uses PDFium for PDF parsing and rendering. It converts text, tables, images, vector paths, and section layout into DOCX output with permissive runtime dependencies.

This project uses PDFium through pypdfium2; it is not affiliated with PDFium, Chromium, or Google.

Install

Install from PyPI:

pip install docx-from-pdf

Install from source:

pip install git+https://github.com/michael-provision/docx-from-pdf.git

Install local development dependencies:

uv venv
uv pip install -r requirements.txt

Usage

Convert a PDF from Python:

from docx_from_pdf import Converter

converter = Converter("input.pdf")
converter.convert("output.docx")
converter.close()

Convert a PDF from the CLI:

docx-from-pdf convert input.pdf output.docx

Extract tables:

from docx_from_pdf import Converter

converter = Converter("input.pdf")
tables = converter.extract_tables()
converter.close()

Development

Run the test suite:

PYTHONPATH=. uv run --no-project --with-requirements requirements.txt --with pytest pytest -q test/test.py

Some visual-comparison tests render DOCX files through LibreOffice on non-Windows systems, so LibreOffice must be installed for the full suite.

License

MIT

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

docx_from_pdf-0.1.2.tar.gz (18.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

docx_from_pdf-0.1.2-py3-none-any.whl (125.0 kB view details)

Uploaded Python 3

File details

Details for the file docx_from_pdf-0.1.2.tar.gz.

File metadata

  • Download URL: docx_from_pdf-0.1.2.tar.gz
  • Upload date:
  • Size: 18.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for docx_from_pdf-0.1.2.tar.gz
Algorithm Hash digest
SHA256 342e066c7812e160e9de2bc1adf71b604c9e4a32bce87ca8b1e6efc86e68fd81
MD5 deaa27ab0e47c80ad12ea2b1307ef354
BLAKE2b-256 31b6544165d8383019c5ad5ad9c70beb2634c32323960994af0df15370269aab

See more details on using hashes here.

File details

Details for the file docx_from_pdf-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: docx_from_pdf-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 125.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for docx_from_pdf-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 13c4a0d5a83b7b78174e9bd0ad58a6595918a7ed1f0bacf43d95417f60b76b31
MD5 0453876b9ba0a2e6e54df1087d941e7c
BLAKE2b-256 6c8628bccf208ff549ec0e91dfd702e70692be990eedbb5e3d31447cb0010489

See more details on using hashes here.

Supported by

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