pypi fpdf2 2.8.6
Strict typing, SVG gradients, Support more font formats (WOFF, WOFF2, TTC/OTC, EBDT/EBLC), new transform() context manager and several bugfixes

13 hours ago

[2.8.6] - 2026-02-18

Added

  • support for FPDF.transform() context manager to apply geometric transformations (translation, rotation, scaling, skewing) to the current graphics state - thanks to @RaphaelFLT
  • support for SVG <linearGradient> and <radialGradient> elements - cf. issue #1580 - thanks to @Ani07-05
  • mypy and pyright checks in the CI pipeline to enforce strict typing
  • support WOFF and WOFF2 fonts - thanks to @BharathPESU
  • TTC/OTC face selection via collection_font_number in add_font()
  • CID-keyed CFF font embedding support
  • Microsoft Symbol font remapping for non-Unicode cmaps
  • support for EBDT/EBLC bitmap fonts

Fixed

  • the A5 value that could be specified as page format to the FPDF constructor was slightly incorrect, and the corresponding page dimensions have been fixed. This could lead to a minor change in your documents dimensions if you used this A5 page format. - cf. issue #1699
  • a bug when rendering empty tables with INTERNAL layout, that caused an extra border to be rendered due to an erroneous use of list.index() - cf. issue #1669
  • edge cases where tiny floating-point drift could trigger incorrect behaviour like issue #1393
  • parentheses are now escaped in more places. This fixes embedding a file with a single parenthesis in the filename, but might also have impacts on e.g. section names.
  • parsing markdown sequences with escape character - cf. issue #1236 - thanks @amidou-naba

Changed

  • improved performance when rendering paths, SVGs, and opaque raster images with an alpha channel - cf. PR #1675
  • typing annotations added across the codebase as part of the strict typing rollout
  • graphics state snapshots now use a GraphicsState dataclass dataclass for clearer usage and stronger typing
  • rotation(), skew(), and mirror() now delegate to transform() for standardized transform application
  • ImageInfo now uses typed dictionaries for clearer usage and stronger typing

Don't miss a new fpdf2 release

NewReleases is sending notifications on new releases.