unstale

pypi / pypdfium2

pypdfium2

What changed in pypdfium2 4 to 5, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.

40 breaking5 security3 deprecations50 new APIs and options3 performance19 behavior and defaults6 tooling41 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

pypdfium2 5162 changes

Breaking changes 37

  • Open, three-sided paths are no longer recognized as rectangles.

    5.15.0release notes

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

    5.14.0release notes

  • The project no longer provides its own conda packaging; the notes say pypdfium2 can instead be installed from PyPI in a conda environment.

    5.14.0release notes

  • The system-generate target is dropped.

    5.14.0release notes

  • Python versions below 3.8 are broken, so developers need Python 3.8 or newer.

    5.13.0release notes

  • The minimum macOS requirement for packaging is now 12.0.

    5.10.1release notes

  • The transitional --no-legacy-gn option has been removed; recent GN is now required.

    5.10.1release notes

  • Formenv lifetime is managed through PdfDocument; close_forms() replaces PdfFormEnv.close().

    5.10.1release notes

  • The parent alias has been removed from PdfFormEnv.

    5.10.1release notes

  • The pdf attribute has been removed; callers should access their PdfDocument object directly.

    5.10.1release notes

  • PdfPage.parent now always points to a PdfDocument rather than sometimes pointing to a PdfFormEnv.

    5.10.1release notes

  • For pages registered as kids of a formenv, parent now points at the formenv and should be treated purely as an autoclose hook.

    5.8.0release notes

  • Raises a meaningful exception when the required textpage is missing.

    5.8.0release notes

  • The setting moved from pypdfium2 to pypdfium2_cfg, which can be imported before pypdfium2 for init-time configuration.

    5.7.0release notes

  • The CLI moved from pypdfium2._cli to its own submodule, with a module invocation and entrypoint available there.

    5.7.0release notes

  • Opening password-protected PDFs is broken on s390x; the release notes describe this platform as use at own risk.

    5.6.0release notes

  • Removed the --use-syslibs option; use build_native instead.

    5.1.0release notes

  • Renamed from sourcebuild.py; the toolchained build script remains available.

    5.0.0release notes

  • The color parameter now comes first, so positional calls may need updating.

    5.0.0release notes

  • The recopy parameter was removed.

    5.0.0release notes

  • Removed; retrieve bitmap information directly from the PdfBitmap object.

    5.0.0release notes

  • Single-channel grayscale bitmaps now use a 2D shape rather than wrapping each pixel value in a list.

    5.0.0release notes

  • Removed; retrieve bitmap information directly from the PdfBitmap object.

    5.0.0release notes

  • Replaced PdfOutlineItem namedtuples with PdfBookmark and PdfDest wrappers, exposing underlying raw objects and distinguishing absent destinations from destinations with unknown mode.

    5.0.0release notes

  • Removed; use PdfPage.render with a loop or process pool instead.

    5.0.0release notes

  • The default flags value changed from FPDF_NO_INCREMENTAL to 0.

    5.0.0release notes

  • Removed the fb_render option; use get_bitmap(render=True) when the rendered bitmap is desired.

    5.0.0release notes

  • Renamed from PdfImage.get_size.

    5.0.0release notes

  • Renamed to PdfImage.get_px_size.

    5.0.0release notes

  • Renamed from PdfObject.get_pos.

    5.0.0release notes

  • Renamed to PdfObject.get_bounds.

    5.0.0release notes

  • Default calls no longer translate implicitly to get_text_bounded; callers are encouraged to use get_text_bounded explicitly for full Unicode support.

    5.0.0release notes

  • Introduced as a replacement for the legacy version flags.

    5.0.0release notes

  • Renamed to build_toolchained.py.

    5.0.0release notes

  • Removed along with the legacy version flags; use PYPDFIUM_INFO or PDFIUM_INFO instead.

    5.0.0release notes

  • Removed along with the legacy version flags; use PDFIUM_INFO instead.

    5.0.0release notes

  • Removed along with the legacy version flags; use PYPDFIUM_INFO instead.

    5.0.0release notes

Security 5

  • Avoids integer overflows while decoding Fax G4 rows.

    5.15.0release notes

  • Updated the bundled PDFium from 8076 to 8146, including fixes for a few CVEs. The notes still advise against exposing pypdfium2 to untrusted input in an unsandboxed environment.

    5.15.0release notes

  • The native sourcebuild includes a cherry-picked OpenJPEG security fix for CVE-2026-6192.

    5.9.0release notes

  • A patch addressing CVE-2025-54874 was cherry-picked into OpenJPEG.

    5.0.0release notes

  • Added --verify to require checking the build attestation; verification is enabled automatically if the gh dependency is installed.

    5.0.0release notes

Deprecations 3

  • Closing foreign bitmaps now warns that the operation may be unsafe because it frees the C-side buffer.

    5.14.0release notes

  • PdfFormEnv.close() is deprecated and is now a no-op; use PdfDocument.close_forms() instead.

    5.10.1release notes

  • The CLI moved to pypdfium2_cli; use pypdfium2_cli.__main__, python3 -m pypdfium2_cli, or the pypdfium2 entrypoint instead.

    5.7.0release notes

New APIs and options 49

  • Adds an API that returns a structure element’s raw type.

    5.15.0release notes

  • Adds an API to read attachment descriptions.

    5.14.0release notes

  • Adds an API to obtain an attachment's MIME type.

    5.14.0release notes

  • Adds an API to write attachment descriptions.

    5.14.0release notes

  • Set warn_on_close to False to silence the warning when you have made sure closing a foreign bitmap is safe.

    5.14.0release notes

  • Adds an API to retrieve bookmark style.

    5.14.0release notes

  • Adds the PdfBookmarkStyle binding.

    5.14.0release notes

  • PDFium adds APIs to read and write attachment descriptions.

    5.13.0release notes

  • The public FormFill API exposes SetTextDirection, allowing integrations to set text direction.

    5.13.0release notes

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

    5.13.0release notes

  • Adds a helper to retrieve a bookmark's color, based on PDFium's FPDFBookmark_GetColor API. It is also integrated into the pypdfium2 toc CLI; the API is not yet available to conda users.

    5.11.0release notes

  • In PORTABLE_MODE, build_toolchained.py can now use clang by passing --clang-path.

    5.10.1release notes

  • The PDFium version can now be configured in cibuildwheel configuration and workflows.

    5.10.1release notes

  • On Linux with glibc, build_native.py can use a sysroot; the current cibuildwheel configuration opts in with USE_SYSROOT=1.

    5.10.1release notes

  • build_native.py accepts --no-legacy-gn to skip legacy GN patches; the option is opt-in for now.

    5.9.0release notes

  • Adds a default-font diagnostic CLI command.

    5.8.0release notes

  • Allows view_pos to be provided as a tuple.

    5.8.0release notes

  • Exposes a helper for PDFium’s default TTF map.

    5.8.0release notes

  • Adds a decoding errors option that defaults to replace.

    5.8.0release notes

  • Adds a helper for loading standard fonts.

    5.8.0release notes

  • Adds the standard-fonts helper.

    5.8.0release notes

  • Adds a textpage passthrough parameter, required for PdfTextObj.extract().

    5.8.0release notes

  • Adds a font diagnostic CLI command.

    5.8.0release notes

  • Added a property for checking whether a PDF font is embedded.

    5.7.1release notes

  • PDFIUM_INFO is now available from within pypdfium2_raw after version information was split into pypdfium2_raw/version.py.

    5.7.0release notes

  • Added a Warning subclass that is issued when XFA form loading fails, providing programmatic error code information instead of only a log message.

    5.7.0release notes

  • This helper wraps FPDF_SYSFONTINFO and related APIs; callers can subclass it to inspect or alter how PDFium uses system fonts.

    5.7.0release notes

  • Added a stub submodule that can be imported before pypdfium2 for init-time configuration; DEBUG_AUTOCLOSE moved to this module.

    5.7.0release notes

  • Saving PDFs can now subset newly embedded fonts, including their width arrays and ToUnicode streams.

    5.6.0release notes

  • Adds an option to build with clang while presenting it to pdfium's build system as gcc; this mode is used to build for s390x with static clang.

    5.5.0release notes

  • Windows-only members are now included in bindings where applicable. Cast an HDC object to pypdfium2.raw.HDC before passing it to FPDF_RenderPage() to ensure compatible types.

    5.5.0release notes

  • Added an option to build_native to disable the libclang_rt dependency.

    5.1.0release notes

  • Added a font helper; the new helpers currently cover font info and object-level text extraction.

    5.1.0release notes

  • Added a text-object helper that currently covers font info and object-level text extraction.

    5.1.0release notes

  • Added a helper for object-level text extraction and font information.

    5.1.0release notes

  • Experimental Android platform support was added for setup and implicit pdfium-binaries downloads on the listed architectures.

    5.0.0release notes

  • Added an environment variable to manually set the full version for other targets.

    5.0.0release notes

  • Added an environment variable to skip the full version for other targets.

    5.0.0release notes

  • Experimental iOS platform handling was added, but iOS will not work yet because library search and binary placement need further changes.

    5.0.0release notes

  • Added context manager support so documents can be used in a with-statement and file descriptors can be explicitly released.

    5.0.0release notes

  • Added scale_to_original, defaulting to True, to temporarily scale a rendered image bitmap to its native pixel size for improved output quality.

    5.0.0release notes

  • Setup now exposes its targets through PDFIUM_PLATFORM, including fallback, system-search, and build-native; uncovered hosts search for system or LibreOffice pdfium before building natively.

    5.0.0release notes

  • Renamed parameters v and h to invert_x and invert_y; behavior is unchanged for callers not using keyword arguments.

    5.0.0release notes

  • Added a container attribute pointing to the parent Form XObject, or None when the object is not nested.

    5.0.0release notes

  • Added to retrieve the corner points of an image or text object.

    5.0.0release notes

  • Added maybe_alpha to use a pixel format with an alpha channel when page content has transparency; setting it to True is recommended when dynamic pixel-format selection is acceptable.

    5.0.0release notes

  • Added a helper for bidirectional translation between page and bitmap coordinates.

    5.0.0release notes

  • Added post-processing options for selective lightness inversion while excluding images, useful for dark themes but with a performance cost.

    5.0.0release notes

  • Embedders can optionally override the selection of SkFontMgr.

    5.0.0release notes

Performance 3

  • Cherry-picked OpenJPEG changes speed up JPEG2000 decoding on arm.

    5.9.0release notes

  • Calls page.get_bbox() only when at least one boundary value is None, avoiding extra overhead when all bounds are given.

    5.7.1release notes

  • The --reset option now uses git restore . rather than git reset --hard, which may be significantly more efficient.

    5.5.0release notes

Behavior and default changes 18

  • CFX_Face supports bare CFF fonts via Skrifa.

    5.15.0release notes

  • CFX_Face supports non-Unicode SFNT charmaps via Skrifa.

    5.15.0release notes

  • Popup appearances are generated only when a popup is opened, changing when that work occurs.

    5.15.0release notes

  • Release wheels use the prefer-sbuild strategy and do not use pdfium-binaries in this release, which may matter when deciding how the wheel obtains PDFium.

    5.15.0release notes

  • The bundled PDFium adds BrotliDecode filter support for PDF 2.0 streams, allowing pypdfium2 users to handle documents using that filter.

    5.11.0release notes

  • For clang versions older than 22, --clang-as-gcc mode is now implicitly enabled.

    5.10.1release notes

  • The riscv64 wheel's glibc requirement was lowered to 2.34 using upstream's sysroot.

    5.10.1release notes

  • The native sourcebuild was updated from PDFium 7191 to 7841, changing the PDFium code used to build the native library.

    5.9.0release notes

  • Objects remove themselves from their parent’s kids cache on garbage collection or closing, and a global ObjectTracker tracks objects by type. This may allow destroying and re-initializing the library during a session.

    5.8.0release notes

  • Now holds a loglevel instead of a bool, distinguishing noisy debug messages from warnings; its default is logging.WARNING.

    5.8.0release notes

  • Added full dependency library vendoring abilities, now the default behavior on fallback setup.

    5.2.0release notes

  • For FPDF_PAGEOBJ_TEXT objects, the constructor now returns PdfTextObj rather than just PdfObject instances.

    5.1.0release notes

  • For FPDF_PAGEOBJ_TEXT objects, now returns PdfTextObj instances rather than just PdfObject instances.

    5.1.0release notes

  • Setup triggers the native build script when a host platform lacks pdfium-binaries and system/LibreOffice pdfium.

    5.0.0release notes

  • Implicit downloads during setup or emplace.py now pin the pdfium version by default, preventing possible API breakage for source installations; update.py and craft.py still default to the latest version.

    5.0.0release notes

  • Document-loading failures now assign err_code to the PdfiumError instance, enabling programmatic handling of the error subtype.

    5.0.0release notes

  • Exposed the previously semi-private flatten method.

    5.0.0release notes

  • Now handles objects nested in Form XObjects using the new pdfium API.

    5.0.0release notes

Tooling 6

  • Setup handles pdfium-binaries for musllinux_armv7l, and this release includes a CIBW build for that platform.

    5.15.0release notes

  • pypdfium2's build configuration and workflows use gn-dist instead of outdated distro packages of GN.

    5.9.0release notes

  • GCC builds now declare a custom toolchain with environment passthrough; CC, CXX, and TOOLPREFIX can select a compatible compiler, and extra compiler and linker flags are honored.

    5.7.0release notes

  • Added release builds for Android arm64_v8a and armeabi_v7a, ppc64le, riscv64, loongarch64, musllinux_armv7l, and s390x; Loongarch is uploaded to GitHub only.

    5.2.0release notes

  • Significant portability enhancements allow use on Linux CPUs that are unhandled or incomplete upstream, may allow native Windows arm64 builds, and add ppc64le cross-compilation from x86_64.

    5.1.0release notes

  • Added a build script that uses system tools and libraries instead of Google's toolchain; GCC is used by default, and Clang should also work with symlinks configured.

    5.0.0release notes

Fixes and other changes 41

  • Fixes closing on interpreter shutdown, which was broken in the previous release.

    5.15.2release notes

  • Prevents object trackers from being modified while traversed, adding protection to closing machinery.

    5.15.2release notes

  • Fixed a float-cast overflow in DrawPath().

    5.15.0release notes

  • Fixed handling of read failures in ReadStream().

    5.15.0release notes

  • Text-page processing now ignores non-finite page objects.

    5.15.0release notes

  • Added handling for a zero-length gradient axis.

    5.15.0release notes

  • FPDF_GetNamedDest() now dereferences old-style named destinations correctly.

    5.15.0release notes

  • Fixed an incorrect PDF major version in the save header.

    5.15.0release notes

  • For PdfDocument and PdfImage.load_jpeg(), a short readinto() now indicates an error when it reads fewer bytes than the buffer size.

    5.14.0release notes

  • Closing or finalizing a bitmap now always calls FPDFBitmap_Destroy(), including for bitmaps created from a native, pdfium-external buffer.

    5.14.0release notes

  • Fixes an off-by-one error that chopped one byte too much from the document identifier.

    5.14.0release notes

  • Windows spoof headers are now included in source distributions, preventing subtly incorrect bindings when installing from an sdist on Windows.

    5.13.0release notes

  • pdfium-binaries builds are now available for mipsle, expanding the architectures developers can use.

    5.13.0release notes

  • Runtime support and source installation compatibility with Python 3.6 and 3.7 were fixed; ctypesgen continues to require Python >=3.8.

    5.13.0release notes

  • PDFium partially fixes RTL character and line reading order in CPDF_TextPage, affecting text extraction from PDFs.

    5.13.0release notes

  • Fixes a missing mkdir call, particularly for the PDFIUM_PLATFORM=system-search / fallback setup.

    5.12.1release notes

  • Adds MIPS 64-bit and 32-bit little-endian wheels to the release on GitHub. PyPI does not accept these wheels, and pip rejects them unless they are locally re-tagged.

    5.11.0release notes

  • Object ordering from FPDFPage_InsertObjectAtIndex() is now preserved when saving.

    5.9.0release notes

  • Adds error checks to rotation retrieval.

    5.8.0release notes

  • Adds error checks to object insertion.

    5.8.0release notes

  • Adds error checks during setup.

    5.8.0release notes

  • Fixes warnings being shown by removing an incorrect logging.captureWarnings(True); warnings.simplefilter("always") is used instead.

    5.8.0release notes

  • Fixed a regression in loose character-box results introduced in the previous release.

    5.7.1release notes

  • The CLI no longer imports pypdfium2.__init__ before preparation, restoring the intended initialization order.

    5.7.1release notes

  • On FreeBSD with libreoffice-pdfium, implicit dependency libraries are pre-loaded with mode=RTLD_GLOBAL to fix library loading.

    5.7.0release notes

  • Input filepaths are encoded as UTF-8 with surrogateescape except on Windows, fixing loading some garbled filenames that previously raised UnicodeEncodeError.

    5.7.0release notes

  • When --test is given, the command now honors the unittests' return code and suppresses a musl-specific failure.

    5.5.0release notes

  • Prevents an infinite loop in AGG when processing degenerate dash patterns.

    5.4.0release notes

  • Fixes reading refine-several symbols in Huffman symbol dictionaries using refinement.

    5.4.0release notes

  • Checks that the bitmap format remains the same before and after progressive rendering.

    5.4.0release notes

  • Fixes shared form XObjects mutating matrix values, preventing unintended changes to shared state during PDF processing.

    5.4.0release notes

  • Fixes text rendering with the wrong x scale when using Skia.

    5.4.0release notes

  • pypdfium2's conda builds now support the ppc64le (glibc) platform.

    5.3.0release notes

  • Fixed handling of odd-sized dashed line arrays in Skia and AGG rendering.

    5.2.0release notes

  • Fixed handling of discard_transparency in PNG encoding.

    5.2.0release notes

  • Fixed compatibility with Python 3.6 and 3.7.

    5.1.0release notes

  • Fixed decoding of JBIG2 files with more than four referred-to segments and progressive unoptimized decoding of a generic region with template 1.

    5.1.0release notes

  • Rolled the musllinux tag back from 1_2 to 1_1; the pdfium-binaries still run on musllinux_1_1.

    5.1.0release notes

  • Fixed a return value error in the JavaScript document getAnnots method.

    5.0.0release notes

  • Incremental saving now works correctly for edited documents.

    5.0.0release notes

  • Selecting replaced text after undo is fixed.

    5.0.0release notes

pypdfium2 45 changes

Breaking changes 3

  • The raw API bindings are isolated in the pypdfium2.raw namespace.

    4.0.0release notes

  • Raw API bindings no longer implicitly encode strings, which may require changes to code that relied on implicit string encoding.

    4.0.0release notes

  • The support model was fully rewritten, changing many existing features and adding helpers; developers should read the updated documentation to migrate their code.

    4.0.0release notes

New APIs and options 1

Behavior and default changes 1

  • Helper objects automatically resolve to the underlying raw object when used as a ctypes function parameter.

    4.0.0release notes