py-pdftools
py-pdftools is a Python library for high-level PDF transformations backed by
Apache PDFBox and compiled to a native library with GraalVM Native Image.
The initial release adds invisible, searchable OCR text layers to existing PDFs without requiring Java at runtime. It accepts provider-independent OCR lines, maps normalized visible-page coordinates through crop boxes and page rotation, fits and embeds Unicode text, and returns a new PDF as bytes.
Self-contained wheels are available from
PyPI for all five
supported platforms. The complete implementation passes native, Python,
installation, and installed-wheel smoke tests. See
PROGRESS.md for
the release verification record.
Installation
python -m pip install tindtechnologies-py-pdftools
The PyPI distribution is named tindtechnologies-py-pdftools; the Python
import remains py_pdftools.
Runtime requirements
- Python 3.10 or newer.
- A platform wheel matching Linux x86-64/ARM64, macOS x86-64/ARM64, or Windows x86-64.
- No Java, JVM, Gradle, Maven, or GraalVM installation.
To build a wheel from source, use
BUILDING.md.
Add an OCR text layer
from pathlib import Path
from py_pdftools import (
NormalizedRect,
OcrDocument,
OcrLine,
OcrPage,
OcrTextLayerOptions,
add_ocr_text_layer,
)
source = Path("scan.pdf").read_bytes()
ocr = OcrDocument(
pages=(
OcrPage(
page_index=0,
orientation=0,
lines=(
OcrLine(
text="Example OCR text",
bounds=NormalizedRect(
left=0.10,
top=0.20,
width=0.40,
height=0.03,
),
confidence=98.4,
),
),
),
),
)
result = add_ocr_text_layer(
source,
ocr,
options=OcrTextLayerOptions(minimum_confidence=80.0),
)
Path("searchable.pdf").write_bytes(result)
OCR bounds use normalized coordinates relative to the visible crop box after
page rotation. The origin is at the visible top-left. orientation is the OCR
text direction in that same visible coordinate system and must be one of 0,
90, 180, or 270: 0 = right, 90 = down, 180 = left, and 270 = up.
By default the OCR document must contain every PDF page exactly once. Set
allow_partial_document=True to modify only supplied pages. Lines below
minimum_confidence are skipped; lines without confidence are retained.
debug_visible_text=True renders the inserted text for placement diagnostics.
Copied or extracted OCR text preserves the exact Unicode sequence supplied in
each OcrLine, including character sequences that a font could render as a
typographic ligature.
Inspect page geometry
from pathlib import Path
from py_pdftools import inspect_pdf
info = inspect_pdf(Path("scan.pdf").read_bytes())
for page in info.pages:
print(
page.page_index,
page.width_points,
page.height_points,
page.rotation,
page.crop_box,
)
Visible width and height reflect the crop box after page rotation. Box coordinates themselves remain in PDF user space.
Behavior and limits
- Existing page streams are preserved and the OCR layer is appended.
- Normal OCR text uses PDF rendering mode 3 (neither fill nor stroke), while remaining searchable and extractable.
- GNU Unifont is subset and embedded. It covers the whole Basic Multilingual
Plane (Latin, Greek, Cyrillic, Arabic, Hebrew, Indic, Thai, CJK, Hangul,
...). Characters outside it, such as emoji, raise
FontErrorinstead of being silently replaced. - Ordinary left-to-right text is supported. Advanced bidirectional and complex script shaping is not guaranteed in version 0.1: right-to-left text is written in its logical order, so extractors that reorder right-to-left runs (pypdf, for example) return those runs reversed.
- The library consumes OCR results; it does not render pages or run an OCR engine.
- Password input is not supported. PDFs requiring a password raise
PdfPasswordRequiredError, and modification restrictions raisePdfPermissionError.
All public failures derive from PdfToolsError. More specific exceptions
distinguish invalid PDFs, invalid OCR data, page mismatches, font coverage,
permissions, native loading, and PDF processing failures.
License
Project code is licensed under the Apache License 2.0. The bundled GNU Unifont
font is licensed separately under the SIL Open Font License 1.1. See
LICENSE,
NOTICE, and the
bundled third-party license texts for details.
Project documentation
SPECS.md— version 0.1 behavior and acceptance contract.BUILDING.md— local builds, tests, and platform wheels.docs/textract-normalization.md— convert Textract-shaped mappings without adding boto3 to the package.docs/native-abi-v1.md— private Python/native protocol.docs/releasing.md— wheel and publication checklist.
Metadata
Release files for tindtechnologies-py-pdftools 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| tindtechnologies_py_pdftools-0.1.3-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details for tindtechnologies_py_pdftools-0.1.3-py3-none-win_amd64.whl |
| tindtechnologies_py_pdftools-0.1.3-py3-none-manylinux_2_28_x86_64.whl | Python 3 | none | Linux glibc 2.28+ x86-64 | Details for tindtechnologies_py_pdftools-0.1.3-py3-none-manylinux_2_28_x86_64.whl |
| tindtechnologies_py_pdftools-0.1.3-py3-none-manylinux_2_28_aarch64.whl | Python 3 | none | Linux glibc 2.28+ ARM64 | Details for tindtechnologies_py_pdftools-0.1.3-py3-none-manylinux_2_28_aarch64.whl |
| tindtechnologies_py_pdftools-0.1.3-py3-none-macosx_11_0_arm64.whl | Python 3 | none | macOS 11.0+ ARM64 | Details for tindtechnologies_py_pdftools-0.1.3-py3-none-macosx_11_0_arm64.whl |
| tindtechnologies_py_pdftools-0.1.3-py3-none-macosx_10_15_x86_64.whl | Python 3 | none | macOS 10.15+ x86-64 | Details for tindtechnologies_py_pdftools-0.1.3-py3-none-macosx_10_15_x86_64.whl |
Total release size: 77.7 MB
Release files / tindtechnologies_py_pdftools-0.1.3-py3-none-win_amd64.whl
| Download URL | tindtechnologies_py_pdftools-0.1.3-py3-none-win_amd64.whl |
|---|---|
| Size | 16.3 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
b0b51edac8efa39dab02c3b9d191278cd437188c3a4c71852012d3b51c59bfc0
|
|
BLAKE2b-256 checksum How to use checksums |
c0e7a876c24b3571c05d5eae4278c397557e0b945462a15c1e40ce79ec0abec1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.
Transparency logRelease files / tindtechnologies_py_pdftools-0.1.3-py3-none-manylinux_2_28_x86_64.whl
| Download URL | tindtechnologies_py_pdftools-0.1.3-py3-none-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 16.4 MB |
| Tags | Linux glibc 2.28+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
bbfabfefa9d35fe9cd1b8e2583a6a8062e2864e4b7c707fc32c4696d47e1bf22
|
|
BLAKE2b-256 checksum How to use checksums |
e01cbd4537054effa5507dbe5a6cd51695ead22b1c7efe55e678a8bf623b8269
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.
Transparency logRelease files / tindtechnologies_py_pdftools-0.1.3-py3-none-manylinux_2_28_aarch64.whl
| Download URL | tindtechnologies_py_pdftools-0.1.3-py3-none-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 16.1 MB |
| Tags | Linux glibc 2.28+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
f2d8e90fffab08c9b913a85040fa701ccf05d49602c39228f5238a7738b67a1b
|
|
BLAKE2b-256 checksum How to use checksums |
039e9dfdca8ada3437e6031792b855ce41c537fadb0f738daec7dd4231eebc97
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.
Transparency logRelease files / tindtechnologies_py_pdftools-0.1.3-py3-none-macosx_11_0_arm64.whl
| Download URL | tindtechnologies_py_pdftools-0.1.3-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 14.4 MB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
8ea8ef7f99ea3a51d70ec73171dd5e386b80fa8164ac221867321e3e2a9c5c38
|
|
BLAKE2b-256 checksum How to use checksums |
b5cb56fb9b649542b0a03b97285cb70134601c47fcc64ef5f0a40b2970009170
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.
Transparency logRelease files / tindtechnologies_py_pdftools-0.1.3-py3-none-macosx_10_15_x86_64.whl
| Download URL | tindtechnologies_py_pdftools-0.1.3-py3-none-macosx_10_15_x86_64.whl |
|---|---|
| Size | 14.4 MB |
| Tags | Python 3 macOS 10.15+ x86-64 |
|
SHA-256 checksum How to use checksums |
8bca355089aee6f71704822bae31e90b99ed85b152a7e5a4e2453382881b9bbd
|
|
BLAKE2b-256 checksum How to use checksums |
036207e0a0de2100ac1abe1e19d6a3fe9d1bb8d6768bf47d10dc92d51be834eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.
Transparency logSecurity for tindtechnologies-py-pdftools 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 5 files in this release have been uploaded with provenance metadata.
Attestation for tindtechnologies_py_pdftools-0.1.3-py3-none-win_amd64.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.