Skip to main content

An ergonomic, fastai-style wrapper over pypdfium2 for reading, searching, previewing, and editing PDFs

Project description

fastpdfium

fastpdfium adds a small ergonomic layer over pypdfium2, the Python binding for PDFium, the PDF engine Chrome uses. It gives you page-tagged text extraction, content-based search whose hits carry their matched text and surroundings, previews with matches highlighted on the rendered page, and simple authoring (text, boxes, images) that pypdfium2 alone doesn’t expose. Pages get a _repr_png_, so a bare PdfPage expression displays itself in any rich frontend: Jupyter, solveit, or an AI-driven kernel.

License

PDFium and pypdfium2 are permissively licensed, so fastpdfium is plain Apache-2.0. If you need structured layout extraction, redaction, or richer authoring, PyMuPDF does more at the cost of AGPL; see fastfitz.

Install

pip install fastpdfium

fastpdfium also registers a pyskill, so AI kernels with pyskills discovery gain PDF reading and editing automatically when fastpdfium is installed.

Quick start

import pypdfium2 as pdfium
from fastpdfium.core import *

pdf = pdfium.PdfDocument('some.pdf')
print(pdf.text(pages=[0]))                 # cheap first: page-tagged text
ms = pdf.search('Delaware')                # content-based matches across the document
ms[0].ctx()                                # the hit marked inline: '...a **Delaware** corporation...'
ms[0].page.preview('Delaware', crop=True)  # see it highlighted on the page
pdf[0]                                     # bare page displays itself

doc = pdfium.PdfDocument.new()             # authoring from nothing
pg = doc.new_page()
pg.insert_text('Hello PDF', 72, 92, size=14)
doc.save('hello.pdf')

Project details


Download files

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

Source Distribution

fastpdfium-0.0.1.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

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

fastpdfium-0.0.1-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fastpdfium-0.0.1.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for fastpdfium-0.0.1.tar.gz
Algorithm Hash digest
SHA256 3bd2b57661698593007cd7875dbdd2f1ef040869f61e5cf4c07425c950bf4b8e
MD5 a856946f65caaf5840ab7fb362b2e0a6
BLAKE2b-256 a7beab12f6838340b37a53859d60257edb9cb9a1bdf40ad5ee939d97ffa6970d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fastpdfium-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for fastpdfium-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6fd744bb017a7acbe9d74b11bb9752624251b26945113c4490a2f1702998e9ee
MD5 c922821675d7981f2c3667fd02823af0
BLAKE2b-256 9d6fda309f79b0de012676d25d92e11a74e2152211caa8d1a0d3554e71e22569

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page