pypi / pypdfium2
pypdfium2
What changed in pypdfium2 5, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-20.
4 breaking1 deprecations9 new APIs and options8 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initpypdfium2 522 changes
Breaking changes 4
Module splitting through PYPDFIUM_MODULES={raw,helpers} is dropped; downstream packagers needing module splitting are advised to patch the project name and module include rules.
The project no longer provides its own conda packaging; the notes say pypdfium2 can instead be installed from PyPI in a conda environment.
The system-generate target is dropped.
Python versions below 3.8 are broken, so developers need Python 3.8 or newer.
Deprecations 1
Closing foreign bitmaps now warns that the operation may be unsafe because it frees the C-side buffer.
New APIs and options 9
Adds an API to read attachment descriptions.
Adds an API to obtain an attachment's MIME type.
Adds an API to write attachment descriptions.
Set warn_on_close to False to silence the warning when you have made sure closing a foreign bitmap is safe.
Adds an API to retrieve bookmark style.
Adds the PdfBookmarkStyle binding.
PDFium adds APIs to read and write attachment descriptions.
The public FormFill API exposes SetTextDirection, allowing integrations to set text direction.
Experimental Pyodide build support was added. Builds are flaky, may crash or freeze on shutdown, and are available for download from GitHub but not PyPI.
Fixes and other changes 8
For PdfDocument and PdfImage.load_jpeg(), a short readinto() now indicates an error when it reads fewer bytes than the buffer size.
Closing or finalizing a bitmap now always calls FPDFBitmap_Destroy(), including for bitmaps created from a native, pdfium-external buffer.
Fixes an off-by-one error that chopped one byte too much from the document identifier.
Windows spoof headers are now included in source distributions, preventing subtly incorrect bindings when installing from an sdist on Windows.
pdfium-binaries builds are now available for mipsle, expanding the architectures developers can use.
Runtime support and source installation compatibility with Python 3.6 and 3.7 were fixed; ctypesgen continues to require Python >=3.8.
PDFium partially fixes RTL character and line reading order in CPDF_TextPage, affecting text extraction from PDFs.
Fixes a missing mkdir call, particularly for the PDFIUM_PLATFORM=system-search / fallback setup.