Skip to main content

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

Release files for docx-from-pdf 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for docx-from-pdf 0.1.3
File Size Uploaded
docx_from_pdf-0.1.3.tar.gz 18.3 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for docx-from-pdf 0.1.3
File Interpreter ABI Platform
docx_from_pdf-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 18.4 MB

Release files / docx_from_pdf-0.1.3.tar.gz

Download URL docx_from_pdf-0.1.3.tar.gz
Size 18.3 MB
Tags Source
SHA-256 checksum
How to use checksums
9ba208581fcbdbc326289cac2958e8c8bf7f247d30c58025790704726544111f
BLAKE2b-256 checksum
How to use checksums
00d09bea6ab9cbe6a85122d1927c2490a59bfd0bfd1e939c788d71254f56567b
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release files / docx_from_pdf-0.1.3-py3-none-any.whl

Download URL docx_from_pdf-0.1.3-py3-none-any.whl
Size 125.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
316099ff6abd2d09c0b9262ca5215d9c7492b19ac53776e3f61f26d9ce6c57d0
BLAKE2b-256 checksum
How to use checksums
b74484f27be32f429e7c645876edd483120921b77e214058d4f56ec58f5df1b3
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page