pypi / fpdf2
fpdf2
What changed in fpdf2 2, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-20.
3 breaking7 new APIs and options1 behavior and defaults30 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initfpdf2 241 changes
Breaking changes 3
Booleans in arrays and dictionaries serialize as lowercase true and false, None in arrays as null, and filtering empty dictionary fields preserves False and numeric zero.
A custom height passed in a text region is now applied to the line it terminates, rather than the first line of the following paragraph.
Rejects SVG <use> cycles and excessive nested expansion to prevent resource exhaustion in FPDF.image().
New APIs and options 7
Adds an align parameter to control horizontal alignment of page-number substitution text inside reserved alias space.
Adds an appearance parameter accepting FileAttachmentAppearance.HIDDEN to hide the annotation's default icon while keeping the embedded file reachable.
Adds support for page number alias substitution with bidirectional and RTL text shaping.
Adds configurable SVG complexity limits when rendering SVG images.
Adds support for keeping aspect ratio for images in templates.
Adds basic support for SVG <switch> elements in the SVG parser.
Adds basic support for SVG <symbol> elements in the SVG parser.
Behavior and default changes 1
Fonts with both outline and bitmap glyphs now prefer outline glyphs.
Fixes and other changes 30
PDF/A-1 documents using TrueType or CFF-based CID fonts now include a /CIDSet stream in each font descriptor, as required by ISO 19005-1.
Escaped Markdown markers adjacent to emphasis markers in link labels no longer lose literal characters or apply unintended styling.
List bullets now use correct font styling instead of inheriting styles from a preceding heading.
List line-height values that are not bare numbers are ignored, using the default line height instead of raising IndexError.
Now accepts 1-element sequences per CSS shorthand rules and preserves existing Padding instances without redundant allocations.
Fixes table cells landing in the wrong column when a row is covered by several rowspans that do not start in column order.
Percentage width and height values with surrounding whitespace no longer raise ValueError.
Fixes a visual gap in subsequent text rendering after a page alias when text shaping is enabled.
CMap mappings are split into blocks of at most 100 entries to meet the PDF specification.
Preserves boundary-neutral formatting during bidirectional text preprocessing.
Embeds CID-keyed CFF fonts as raw CFF programs so browser PDF viewers render them correctly.
Fixes the number of surviving escape characters.
Fixes text rendering when the first text on a page starts with a fallback glyph.
Dry runs now preserve link annotations and markdown formatting; ToC dry runs also preserve page order.
Can restore current_font when the selected font state has diverged.
Preserves consecutive markdown links without intervening spaces and supports markdown styling around links.
Treats RuntimeError like ImportError for the optional numpy import, so unsupported CPUs make numpy unavailable instead of causing import fpdf to fail.
Declares the default base state and display order so PDF viewers can list layers correctly.
Leading spaces on new lines inside preformatted blocks are no longer dropped.
Fixes rendering SVG arcs with very small sweeps that previously rounded to zero.
Counts SVG <switch> elements toward SVG complexity limits.
Font state no longer leaks onto the FPDF instance after text_columns() or text_region() exits, so subsequent cell() or write() calls use the caller's font.
Font state no longer leaks onto the FPDF instance after text_region() exits, so subsequent cell() or write() calls use the caller's font.
Avoids a spurious horizontal-space error when unbreakable text is split into many small fragments, such as by alternating fallback and main fonts.
Resets graphics state for ToC rendering and fixes page order after multi_cell dry runs in a ToC.
Fixes transform application on user space gradients.
Fixed the types for FPDF.add_font().
Fixed the types for FPDF.output().
Fixed the type for FPDF.title.
Reverted changes to ImageInfo that impacted the user-facing API.