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.3.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.3-py3-none-any.whl (125.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: docx_from_pdf-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 9ba208581fcbdbc326289cac2958e8c8bf7f247d30c58025790704726544111f
MD5 afcf0026e0d5c4f6713078b02b71d42c
BLAKE2b-256 00d09bea6ab9cbe6a85122d1927c2490a59bfd0bfd1e939c788d71254f56567b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: docx_from_pdf-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 125.8 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 316099ff6abd2d09c0b9262ca5215d9c7492b19ac53776e3f61f26d9ce6c57d0
MD5 4740a398fb85b00e7600f8668de971f6
BLAKE2b-256 b74484f27be32f429e7c645876edd483120921b77e214058d4f56ec58f5df1b3

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