Skip to main content

pdflite

pdf_md converts every page with pdf-oxide and fixes four things conversion gets wrong:

  • a word broken across lines by a hyphen is rejoined
  • a two-column table reflowed into one stream is swapped for the plain-text layer, when that strands fewer values
  • a scanned page with no text layer goes through OCR
  • reader chrome from a print-to-PDF is dropped
from pdflite import pdf_md

md = pdf_md('pdfs/attention_is_all_you_need.pdf', out_path='out'); md[:100] # out_path stores images
# pages = pdf_md('statement.pdf', out_path='out', pages=True)  # one entry per page
Dictionary used where Stream expected, treating as empty stream
Dictionary used where Stream expected, treating as empty stream
Dictionary used where Stream expected, treating as empty stream
Dictionary used where Stream expected, treating as empty stream

'Provided proper attribution is provided, Google hereby grants permission to reproduce the tables and'

Each fix is exported on its own: clean_md, fix_layout, orphan_vals, scrambled_layout, needs_ocr, ocr_parse, oxide_parse.

clean_md('a docu-\nment')      # a hyphen split across lines
'a document'
orphan_vals('Opening balance\nFees\n1,240.00\n18.50')   # values cut loose from their labels
2

Install

pip install pdflite

OCR needs liteparse, imported when it runs. No extras: an optional package is imported where it is used and raises saying what to install.

Metadata

Release files for pdflite 0.0.2

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

Source distribution (sdist)

Source distribution for pdflite 0.0.2
File Size Uploaded Provenance Actions
pdflite-0.0.2.tar.gz 9.4 kB Without provenance Details for pdflite-0.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pdflite 0.0.2
File Interpreter ABI Platform Actions
pdflite-0.0.2-py3-none-any.whl Python 3 none any Details for pdflite-0.0.2-py3-none-any.whl

Total release size: 19.0 kB

Release files / pdflite-0.0.2.tar.gz

Download URL pdflite-0.0.2.tar.gz
Size 9.4 kB
Tags Source
SHA-256 checksum
How to use checksums
020dbdacad6265ae79ab2296e5f81337f5e0d4788dc320f6ef23d4995addf1dd
BLAKE2b-256 checksum
How to use checksums
ec3c123e556647d9ee7a806c51a446dfe6b7d45eec45e4af4281a8da58f19502
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / pdflite-0.0.2-py3-none-any.whl

Download URL pdflite-0.0.2-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7cdb70aa9e5f5106c029833307e01bf1606478b4b2ddb7af4fa22f3b5e95ef9d
BLAKE2b-256 checksum
How to use checksums
eae4e82761f5f48bbb5dd8f6eef9bf6e2fbb05be52236f565d4ec317dfadf8b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Security for pdflite 0.0.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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

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