Metadata-Version: 2.4
Name: docx-from-pdf
Version: 0.1.7
Summary: Python library and CLI for converting PDF files to DOCX.
Home-page: https://github.com/michael-provision/docx-from-pdf/
Author: Michael Ellis
License: MIT
Keywords: pdf-to-word,pdf-to-docx,docx-from-pdf
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pypdfium2>=5.11.0
Requires-Dist: Pillow>=10.0.0
Requires-Dist: python-docx>=0.8.10
Requires-Dist: fonttools>=4.24.0
Requires-Dist: numpy>=1.17.2
Requires-Dist: opencv-python-headless>=4.5
Requires-Dist: fire>=0.3.0
Dynamic: author
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: license-file
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# 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.

Page headers and footers become Word headers and footers: rows at a page's top
or bottom edge that repeat at the same place on another page (such as a
letterhead), or, on a single page, an edge group carrying a page number that
stands clear of the body. Page numbers that follow the document's own numbering
become PAGE and NUMPAGES fields.

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

## Install

Install from PyPI:

```bash
pip install docx-from-pdf
```

Install from source:

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

Install local development dependencies:

```bash
uv venv
uv pip install -r requirements.txt
```

## Usage

Convert a PDF from Python:

```python
from docx_from_pdf import Converter

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

Convert a PDF from the CLI:

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

Extract tables:

```python
from docx_from_pdf import Converter

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

## Development

Run the test suite:

```bash
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
