Skip to main content

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')

Metadata

Release files for fastpdfium 0.0.1

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

Source distribution (sdist)

Source distribution for fastpdfium 0.0.1
File Size Uploaded
fastpdfium-0.0.1.tar.gz 10.7 kB Details

Built distribution (wheel)

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

Total release size: 22.4 kB

Release files / fastpdfium-0.0.1.tar.gz

Download URL fastpdfium-0.0.1.tar.gz
Size 10.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3bd2b57661698593007cd7875dbdd2f1ef040869f61e5cf4c07425c950bf4b8e
BLAKE2b-256 checksum
How to use checksums
a7beab12f6838340b37a53859d60257edb9cb9a1bdf40ad5ee939d97ffa6970d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / fastpdfium-0.0.1-py3-none-any.whl

Download URL fastpdfium-0.0.1-py3-none-any.whl
Size 11.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6fd744bb017a7acbe9d74b11bb9752624251b26945113c4490a2f1702998e9ee
BLAKE2b-256 checksum
How to use checksums
9d6fda309f79b0de012676d25d92e11a74e2152211caa8d1a0d3554e71e22569
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.0.1 This release

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