unstale

pypi / pypdf

pypdf

What changed in pypdf 5 to 7, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-26.

22 breaking79 security4 deprecations23 new APIs and options27 performance13 behavior and defaults2 tooling104 fixes and other

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

npx @unstale/cli init

@unstale/cli on npm

pypdf 734 changes

Breaking changes 6

  • add_outline_item is now keyword-only.

    7.1.0release notes

  • Support for cryptography versions below 43 has been removed.

    7.0.0release notes

  • File identifiers are now non-deterministic, changing how identifiers behave.

    7.0.0release notes

  • Image size limits are now applied more strictly.

    7.0.0release notes

  • Object streams with offsets that are not strictly increasing are now blocked.

    7.0.0release notes

  • Python 3.9 is no longer supported.

    7.0.0release notes

Security 5

  • Restricts work and memory used for cross-reference streams.

    7.1.1release notes

  • Limits inline image size on the known-size fallback path.

    7.1.1release notes

  • Limits overall page label size before using a fallback.

    7.1.1release notes

  • Image buffer sizes are determined using the actual bytes per pixel.

    7.0.1release notes

  • Work performed while decoding XFA forms is now limited.

    7.0.0release notes

Deprecations 1

  • Passing a boolean to remove_images is deprecated.

    7.1.0release notes

New APIs and options 1

  • Rectangle annotations can now be given a border color.

    7.0.0release notes

Performance 12

  • Reduces memory usage when removing whitespace during ASCIIHexDecode.

    7.1.1release notes

  • Indexes named destinations when appending a document.

    7.1.1release notes

  • Lists image identifiers only once when iterating over page images.

    7.1.1release notes

  • Decodes PDFDocEncoding strings using str.translate instead of per-character concatenation.

    7.1.1release notes

  • Per-character direction checks are skipped for left-to-right text.

    7.1.0release notes

  • Streams are no longer decoded to find identical objects.

    7.1.0release notes

  • The pure-Python RC4 implementation used without a crypto library is faster.

    7.1.0release notes

  • Content streams without text operators are no longer parsed, improving text extraction performance.

    7.0.1release notes

  • LZW decoding is faster for clear table markers.

    7.0.0release notes

  • The page label number tree is read once for all pages.

    7.0.0release notes

  • The PNG Up predictor is decoded a row at a time.

    7.0.0release notes

  • Right-to-left text runs are now built with a single join.

    7.0.0release notes

Behavior and default changes 1

  • A soft mask is scaled to the size of its image.

    7.1.0release notes

Fixes and other changes 8

  • Labels a page that lies between the /Limits of two page label kids.

    7.1.1release notes

  • Rejects slices with a zero step.

    7.1.1release notes

  • The operations in a replicated content stream are copied.

    7.0.1release notes

  • More rendering intents are handled for inline images.

    7.0.1release notes

  • Page reference lookup works for hierarchical page trees.

    7.0.1release notes

  • UTF-8 text strings are decoded.

    7.0.1release notes

  • Cloning now works for objects that require constructor arguments.

    7.0.0release notes

  • XMP packets are serialized without an XML declaration.

    7.0.0release notes

pypdf 6226 changes

Breaking changes 11

Security 74

Deprecations 3

  • The PdfWriter method add_js is being replaced.

    6.19.0release notes

  • The previously missed inline_images setter is deprecated.

    6.15.0release notes

  • Support for abbreviations in decode_stream_data is deprecated.

    6.7.0release notes

New APIs and options 19

  • Allows custom fit modes for named destinations.

    6.21.0release notes

  • Adds support for the BrotliDecode filter in PDF 2.0.

    6.20.0release notes

  • Use apply_configuration as a context manager to temporarily overwrite configuration values.

    6.18.0release notes

  • Set disable_legacy_handling to avoid legacy handling overhead after migrating configuration overwrites.

    6.18.0release notes

  • Use overwrite_configuration to change configuration values for the whole session.

    6.18.0release notes

  • Adds an actions base class.

    6.15.0release notes

  • Allows keeping the original PDF header in non-incremental clone mode.

    6.15.0release notes

  • Adds support for RTL appearance streams with Arabic characters.

    6.15.0release notes

  • Adds a way to check whether an image is displayed on a given page.

    6.14.0release notes

  • Adds Japanese predefined CMaps.

    6.13.0release notes

  • A Font can now be initialised from an embedded font file.

    6.11.0release notes

  • Exposes the /Perms verification result on the Encryption object.

    6.9.0release notes

  • Adds /IRT (in-reply-to) support for markup annotations.

    6.8.0release notes

  • Font resources can now be added for 14 Adobe Core fonts in text widget annotations.

    6.7.0release notes

  • FontDescriptor can be initiated from an embedded font resource.

    6.5.0release notes

  • Comb fields in text widget annotations can now be parsed and formatted.

    6.4.0release notes

  • Text can be wrapped and aligned in flattened PDF forms.

    6.3.0release notes

  • Adds a strict parameter to PDFWriter.

    6.2.0release notes

  • BlackIs1 functionality is moved to tiff_header.

    6.0.0release notes

Performance 14

  • Avoids scanning all objects in get_outline_root.

    6.21.3release notes

  • Collects named destinations once when resolving links.

    6.21.3release notes

  • Avoids repeated full file loads.

    6.21.2release notes

  • Speeds up cloning direct objects.

    6.20.0release notes

  • Parses an embedded CFF font program once per stream, reducing repeated parsing work.

    6.20.0release notes

  • Speeds up parsing numbers, indirect references, names and nulls.

    6.20.0release notes

  • Reduces the number of full data lookups for the attachment mapping API.

    6.19.0release notes

  • Repeated character lookups are cached during text extraction.

    6.17.0release notes

  • Builds /ToUnicode source-code bytes directly, improving the parsing path.

    6.16.0release notes

  • Avoids a per-pixel getpixel loop for 1-bit indexed images.

    6.13.3release notes

  • Retrieval of named destinations in the reader is optimized.

    6.12.0release notes

  • Fixes O(n²) performance in NameObject read/write.

    6.9.0release notes

  • All objects in an ObjStm are batch-parsed on first access.

    6.9.0release notes

  • The loop for layout mode text extraction was optimized, improving its performance.

    6.4.1release notes

Behavior and default changes 11

  • Declares official support for Python 3.15.

    6.20.0release notes

  • Encoding is also parsed for embedded CFF Type1 fonts.

    6.17.0release notes

  • Allows arbitrary rotations and applies rotations for annotation appearance streams.

    6.16.0release notes

  • Considers more encodings for Type1 core fonts.

    6.16.0release notes

  • Adds an ActualText tag when producing an RTL appearance stream.

    6.15.0release notes

  • Collects all character widths, including widths for characters that cannot be Unicode mapped.

    6.13.0release notes

  • SASLprep (RFC 4013) is implemented for AES-256 password normalization.

    6.12.0release notes

  • A CID font resource from a font file can encode more characters.

    6.12.0release notes

  • MD5 key derivation is skipped for AES-256 encrypted PDFs.

    6.10.0release notes

  • Generated text appearance streams have embellishments, affecting the appearance of generated text.

    6.6.0release notes

  • Early EOD for RunLengthDecode now produces a warning instead of an error.

    6.5.0release notes

Tooling 2

  • Declares protocol data members on PdfReader and PdfWriter.

    6.20.0release notes

  • The type hint uses Mapping instead of dict.

    6.1.2release notes

Fixes and other changes 92

  • Reverts rejection of unsupported key lengths in the /Encrypt dictionary.

    6.21.3release notes

  • Avoids excessive error messages.

    6.21.3release notes

  • Resolves indirect widths in CID font /W arrays.

    6.21.3release notes

  • Keeps 8-bit DeviceRGB image mode.

    6.21.2release notes

  • Preserves all annotation quadrilaterals when merging pages.

    6.21.2release notes

  • Decodes UniGB-UTF16 CMaps as UTF-16BE.

    6.21.2release notes

  • Avoids overwriting unread objects in add_form_topname.

    6.21.0release notes

  • Treats NUL as whitespace in ArrayObject.

    6.21.0release notes

  • Reads an indirect page box on a writer page.

    6.21.0release notes

  • Only reads the color operator from a text field's default appearance.

    6.20.1release notes

  • Accepts an %%EOF marker that is not at the start of a line.

    6.20.0release notes

  • Adds more robust guards around fontTools.

    6.20.0release notes

  • Drops a /Kids entry resolving to null instead of raising a cycle error.

    6.20.0release notes

  • Reports the correct page number for identical pages.

    6.20.0release notes

  • Flattens the page tree iteratively.

    6.20.0release notes

  • Ignores invalid character codes for TrueType and Type1 font widths.

    6.20.0release notes

  • Decrypts the XMP metadata stream unless /EncryptMetadata is false.

    6.20.0release notes

  • A string rect passed to add_uri is parsed into a rectangle.

    6.19.0release notes

  • Appending pages with non-terminal fields no longer copies unrelated pages.

    6.19.0release notes

  • Existing internal link targets use a page reference.

    6.19.0release notes

  • Arabic-Indic digits are no longer reversed during text extraction.

    6.19.0release notes

  • Compatibility is fixed for fonttools versions below 4.58.0.

    6.18.1release notes

  • FreeText default appearance uses the font color.

    6.18.1release notes

  • The letters for /S /A and /S /a page labels repeat past Z.

    6.18.1release notes

  • visitor_text uses the current text matrix.

    6.18.1release notes

  • Draw borders and backgrounds for appearance streams and annotations.

    6.18.0release notes

  • Annotations without a subtype are handled during merge.

    6.17.0release notes

  • Duplicate dictionary keys are detected even when the first value is falsy.

    6.17.0release notes

  • An empty /Filter array is treated as no filter when extracting images.

    6.17.0release notes

  • Setting is_open=False collapses outline items.

    6.17.0release notes

  • A non-array destination no longer causes a crash.

    6.17.0release notes

  • Trailing duplicate %%EOF markers are skipped when locating startxref.

    6.17.0release notes

  • The annotation appearance stream matrix is updated when a page is transformed.

    6.16.2release notes

  • Text extraction in layout mode is more lenient about space width.

    6.16.2release notes

  • Repeated page references are now allowed.

    6.16.2release notes

  • The RC4 fallback is improved when cryptography cannot provide it.

    6.16.2release notes

  • remove_from_tree() now works on outline items.

    6.16.2release notes

  • Escapes parentheses only for 8-bit fonts.

    6.16.0release notes

  • Keeps Adobe CMYK inversion when an explicit /Decode is present.

    6.16.0release notes

  • Fixes false inline image end markers.

    6.16.0release notes

  • Preserves internal Link annotations when appending or merging PDFs.

    6.16.0release notes

  • Applies character spacing per glyph during layout-mode extraction.

    6.16.0release notes

  • Recovers the trailer from a cross-reference stream when rebuilding the xref.

    6.16.0release notes

  • Decodes low-bit DeviceRGB images as RGB instead of palette.

    6.15.0release notes

  • Correctly handles IndirectObject in DecodeParms.

    6.15.0release notes

  • Expands low-bit samples for images without a filter.

    6.15.0release notes

  • Fixes an UnboundLocalError when reading a malformed cross-reference table entry.

    6.13.2release notes

  • Accepts an inline image EI marker at the end of a content stream.

    6.13.0release notes

  • Handles a /Pages node without /Kids during flattening.

    6.13.0release notes

  • Recovers from a corrupt trailing startxref pointer.

    6.13.0release notes

  • Prevents cyclic parent hierarchies for inherited dictionaries.

    6.12.1release notes

  • Deals with an invalid first code in the LZW decoder.

    6.12.1release notes

  • AppearanceStream honors a user-set font name when annotations are not flattened.

    6.12.0release notes

  • Excessive whitespace in layout mode text extraction is avoided.

    6.12.0release notes

  • Fixes a KeyError when inserting fresh children.

    6.12.0release notes

  • AES padding length can now be fixed in non-strict mode.

    6.11.0release notes

  • Decryption errors now take the strict mode setting into account.

    6.10.1release notes

  • The remove_orphans option is used when compressing identical objects.

    6.10.0release notes

  • Fixes link pairing when annotations include non-links.

    6.10.0release notes

  • Fixes stale cached objects originating from non-authoritative object streams.

    6.10.0release notes

  • Fixes PdfReadError when an xref table contains comments before the trailer.

    6.10.0release notes

  • Resolves an UnboundLocalError for xobjs.

    6.9.2release notes

  • Avoids sharing array-based content streams between pages.

    6.9.0release notes

  • Avoids accessing an invalid page when inserting a blank page under some conditions.

    6.9.0release notes

  • Invalid annotations are now handled in extract_links.

    6.7.4release notes

  • Fixes a wrong LUT size error.

    6.7.2release notes

  • Fixes handling of page boxes defined on /Pages.

    6.7.2release notes

  • Avoids division by zero when decoding FlateDecode PNG prediction.

    6.7.1release notes

  • Avoids applying its own object replacement logic when replacing page contents.

    6.7.1release notes

  • Fixes an UnboundLocalError when updating page form field values containing /Sig.

    6.7.1release notes

  • Fixes AESV2 decryption when the encrypt dictionary is missing /Length.

    6.7.0release notes

  • Fixes merging when annotations point to NullObject.

    6.7.0release notes

  • Checks whether self._info is None in compress_identical_objects.

    6.7.0release notes

  • Avoids invalid loads for ICCBased FlateDecode images in mode 1.

    6.7.0release notes

  • Handles /AcroForm being a NullObject.

    6.6.1release notes

  • Handles missing font bounding boxes gracefully.

    6.6.1release notes

  • Multi-byte BOM-like sequences are no longer treated as BOMs.

    6.6.0release notes

  • Empty FlateDecode outputs are avoided without warning.

    6.6.0release notes

  • Compatibility with Pillow 12.1.0 and later was fixed.

    6.6.0release notes

  • Allows fallback to PBM files when jbig2dec lacks PNG support.

    6.5.0release notes

  • Allows deleting annotations that do not exist.

    6.4.2release notes

  • Fixes a KeyError when flattening a form field whose resources lack /Font.

    6.4.2release notes

  • Choice fields without an /Opt key no longer cause a failure.

    6.4.1release notes

  • Whitespace is silently ignored when detecting an Adobe Ascii85 suffix.

    6.4.0release notes

  • JPEG image quality is preserved by default.

    6.3.0release notes

  • Fixes missing PreventGC when cloning.

    6.3.0release notes

  • Fixes PdfWriter.append failing when there are articles being None.

    6.2.0release notes

  • PageObject.scale() no longer scales the media box incorrectly.

    6.1.3release notes

  • Handling of malformed cross-reference tables is improved.

    6.1.2release notes

  • pypdf now deals with incorrect sizes in incremental PDF files.

    6.1.2release notes

  • Handling of zero-length StreamObject instances is fixed.

    6.1.2release notes

  • Go-To actions without a destination are skipped.

    6.0.0release notes

pypdf 514 changes

Breaking changes 5

  • AnnotationBuilder is removed; use annotations instead.

    5.0.0release notes

  • PdfMerger is removed; use PdfWriter instead.

    5.0.0release notes

  • Reports PdfReadError instead of RecursionError.

    5.0.0release notes

  • Support for Python 3.7 is dropped.

    5.0.0release notes

  • Raises PdfReadError when /Root is missing from the trailer.

    5.0.0release notes

New APIs and options 3

Performance 1

  • PDF files are compressed by merging identical objects.

    5.0.0release notes

Behavior and default changes 1

Fixes and other changes 4