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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pdflite-0.0.1.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pdflite-0.0.1-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file pdflite-0.0.1.tar.gz.

File metadata

  • Download URL: pdflite-0.0.1.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for pdflite-0.0.1.tar.gz
Algorithm Hash digest
SHA256 49aefb491f7aa4088c0cb1746bd5457a97fa5545f1d094495f1d702812a4cfee
MD5 07d5f06b01bbd67f5236968df2d83adf
BLAKE2b-256 aaf2208acf01a9e3e44f4a81e6dac308a1b52a120f2e2247a1192df4da6fde14

See more details on using hashes here.

File details

Details for the file pdflite-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pdflite-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for pdflite-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8503971990cb90e7fbf11a0eef98a7f12d161a5d3a3cca72912a6accc57eaeb3
MD5 9c746c127da88425d8fefed5df6a58b8
BLAKE2b-256 2ae0e91505faafc29025545687859d50fbc9c9ba17aebd2d84c399bbbe1c825c

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 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