Skip to main content

platen-document

platen-document is a standalone local Python document-processing SDK copied from PDFNest's proven local OCR V2 engine.

The 0.1.x releases are parity-focused for existing default consumers. They are intentionally not a general OCR-quality redesign; explicitly documented opt-in capabilities may add bounded structure recovery without changing the default detector, rendering, or validation contracts.

Included capabilities

  • native PDF text extraction and conservative native/scanned routing;
  • local Tesseract OCR with explicit languages and the current bounded AUTO policy;
  • canonical word, line, block, reading-order, provenance, and validation results;
  • structured-document extraction with the current bounded headings, lists, and simple-table behavior;
  • Markdown rendering;
  • searchable-PDF rendering with invisible text and independent validation;
  • query-based and typed region-based Highlight, Underline, and Strikeout markup; and
  • local capability inspection through DocumentProcessor.capabilities() or platen-document doctor.

Minimal usage

from platen_document import DocumentProcessor

processor = DocumentProcessor()
ocr_result = processor.extract_text("document.pdf")
structured = processor.extract_document("document.pdf")
markdown = processor.to_markdown(structured)
processor.make_searchable_pdf("scanned.pdf", "scanned-searchable.pdf")

Application adapters that need to preserve the canonical searchable-PDF profile can use the public profile enum and pass an already extracted result to the render step, avoiding a second OCR pass:

from platen_document import DocumentProcessor, OCRProfile

processor = DocumentProcessor()
result = processor.extract_text("scanned.pdf", profile=OCRProfile.SEARCHABLE_PDF_V2)
processor.make_searchable_pdf(
    "scanned.pdf",
    "scanned-searchable.pdf",
    result=result,
    job_id="optional-diagnostic-correlation",
)

extract_text also accepts the copied worker's routing_policy plus optional cooperative cancellation_check, page_timeout_seconds, and page_progress_callback controls. These are thin engine controls for an application adapter; the SDK still does not own application jobs or storage. The default routing policy preserves validated native text when appropriate. An application adapter with a historical OCR-only contract may opt into routing_policy="FORCE_OCR"; this selects the OCR route without changing the default behavior of existing consumers.

The package can process local files without PDFNest backend, PostgreSQL, Redis, Dramatiq, frontend, HTTP services, authentication, billing, or application storage.

For upright scanned pages containing a clear ruled table, table-aware structured extraction is an explicit opt-in because it can change OCR segmentation and structured output:

from platen_document import DocumentProcessor, EngineConfiguration

processor = DocumentProcessor(EngineConfiguration(
    enable_scanned_table_recognition=True,
))
structured = processor.extract_document("scanned-table.pdf")

This bounded path removes detected long ruling lines before the same single Tesseract pass and reconstructs conservative aligned numeric rows. It is not a promise of arbitrary scanned-table recognition. The default is False, so other structured and OCR-text consumers retain their existing behavior.

Region-based markup

DocumentProcessor.apply_markup_regions accepts typed, one-based page regions in the existing visible CropBox-relative PDF-point coordinate space. Manual regions annotate directly without OCR. OCR-aware regions can reuse a public DocumentResult to avoid a second extraction pass, or perform one public extract_text pass when no result is supplied. Per-region colors, cooperative cancellation, and real annotation progress are supported. See the region markup API guide for the full coordinate, password, result, and overlap contract.

Version 0.1.1 fixed native rotated-page region selection without changing the public visible-region API or OCR/scanned geometry behavior. Version 0.1.2 extends that same coordinate contract to manual region annotation: the visible input rectangle is mapped exactly once into canonical PDF coordinates at the PyMuPDF writer boundary. Native PyMuPDF word boxes remain in unrotated PDF coordinates; OCR boxes remain in their existing visible space.

Configuration and system dependencies

Python dependencies are declared in pyproject.toml. The runtime expects a system Tesseract installation and discovers its executable, tessdata directory, and installed language packs. It never installs operating-system packages or downloads OCR models.

from platen_document import DocumentProcessor, EngineConfiguration

processor = DocumentProcessor(EngineConfiguration(
    tesseract_binary="/usr/bin/tesseract",
    tessdata_dir="/usr/share/tesseract-ocr/5/tessdata",
))

The encoded OCR raster normally carries the configured DPI as PNG metadata. An adapter that must reproduce a historical OCR input contract can opt into the neutral public compatibility policy without changing rendered pixels:

from platen_document import (
    DocumentProcessor,
    EngineConfiguration,
    RasterDpiMetadataPolicy,
)

processor = DocumentProcessor(EngineConfiguration(
    raster_dpi=144,
    raster_dpi_metadata_policy=RasterDpiMetadataPolicy.OMIT_DPI,
))

EMBED_DPI is the default. OMIT_DPI changes only the DPI metadata in the encoded OCR image; it does not change raster dimensions, page geometry, or the Tesseract language/routing policy. This option is intended for a consumer-specific compatibility adapter, not for a product-wide environment switch.

The copied engine retains its known tessdata fallback behavior, including fallback from a stale TESSDATA_PREFIX when a known local system directory is available.

Diagnostics

platen-document doctor

The doctor output contains safe local capability metadata only. It does not know about PDFNest users, guests, quotas, jobs, queues, storage providers, or secrets.

Boundary and current PDFNest consumer status

PDFNest authentication, anonymous ownership, quotas, rate limits, durable job orchestration, storage policy, cleanup, product routes, and UI remain outside this package. The following PDFNest consumers now have independent, consumer-specific internal|sdk execution boundaries:

  • OCR Text V2 (OCR_TEXT_ENGINE);
  • Searchable PDF V2 (SEARCHABLE_PDF_ENGINE);
  • Document Extraction V2 (DOCUMENT_EXTRACTION_ENGINE);
  • PDF-to-Markdown V2 (PDF_TO_MARKDOWN_ENGINE);
  • OCR-aware Highlight/Underline/Strikeout (OCR_MARKUP_ENGINE); and
  • General Editor OCR (EDITOR_OCR_ENGINE).

Each selector defaults to internal; sdk is an explicit opt-in. The frozen PDFNest implementation remains available as the default and configuration-only rollback/reference path; there is no implicit runtime fallback from a selected SDK engine. PDF-to-Word OCR fallback and Studio OCR/document paths remain internal-only and are not migrated.

Registry delivery remains separately classified DOCUMENT_SDK_REGISTRY_DEPENDENCY_DELIVERY_BLOCKED_EXTERNAL; no package has been published to a public registry.

Metadata

Release files for platen-document 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 platen-document 0.1.3
File Size Uploaded
platen_document-0.1.3.tar.gz 83.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for platen-document 0.1.3
File Interpreter ABI Platform
platen_document-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 166.8 kB

Release files / platen_document-0.1.3.tar.gz

Download URL platen_document-0.1.3.tar.gz
Size 83.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c0e7b3e40c646a52c52a87e503114ac85c1bafa812c5af92fb12a71d92338023
BLAKE2b-256 checksum
How to use checksums
9426772fc4cec3634510ece855f1851920a5d5ce340454fb6fddfc08c6728f11
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 8, 2026.

Transparency log

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

Download URL platen_document-0.1.3-py3-none-any.whl
Size 82.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ab53505679cd0f7487199652be62224ae10c16a52a36dec72adbfc8e262fd31d
BLAKE2b-256 checksum
How to use checksums
1b1687f59100e57e4a651a30c813ca451abd53b53943ad016cd24a5a8f4c86ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 8, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

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