I wrote my latest post on fpdf2 almost a year ago.
As we just released a new version, v2.7.3,
this is the time to mention some recent additions to this library! 😊
This article will present some of the major features introduced between v2.5.3 & v2.7.3 of fpdf2:
- Tables
- Images & shapes
- Fonts & text
- Signing & encrypting documents
- Annotations
- Documentation & translated tutorials
- What's coming next?
Tables
One major addition of v2.7.0 of fpdf2 has the new method .table(),
that now makes very easy the generation of tables in PDF documents.
We documented how to use this method in a dedicated documentation page: https://pyfpdf.github.io/fpdf2/Tables.html
Here is some snippet of demo code:
from fpdf import FPDF
TABLE_DATA = (
("First name", "Last name", "Age", "City"),
...
)
pdf = FPDF()
pdf.add_page()
pdf.set_font("Helvetica", size=16)
with pdf.table(borders_layout="MINIMAL",
col_widths=(30, 30, 10, 30),
cell_fill_color=200, # grey scale
cell_fill_mode="ROWS",
text_align="CENTER") as table:
for data_row in TABLE_DATA:
row = table.row()
for datum in data_row:
row.cell(datum)
pdf.output("table-demo.pdf")
And the result:

Images & shapes
There has been several new features related to images:
-
FPDF.image()has two new optional parameters:align="C"to horizontally an image on a page, andkeep_aspect_ratiowhich allows to preserve an image ratio. Related documentation section: fitting an image inside a rectangle. -
thanks to a contribution by @eroux in PR #709, ICC Profiles of images inserted by
FPDF.image()are now extracted an inserted in the PDF document: doc. -
rectangles drawn with
FPDF.rect()can now have rounded corners using the newround_cornersparameter. Check the documentation for examples: Shapes: rectangles with round corners. -
we documentated on how to control transparency of overlapping text, shapes and images through
stroke_opacity&fill_opacity: documentation.

Fonts & text
-
since v2.5.7,
fpdf2now uses the popular fontTools library to read and embed fonts in the PDF. This extended the range of font definition files supported byfpdf2, and also made the code used to parse & insert fonts a lot more robust. Thanks a lot to @RedShy for this change made in PR #477. -
@andersonhc introduced a font fallback mechanism controlled by a new method
FPDF.set_fallback_fonts()in PR #669: related documentation. -
@gmischler provided support for subscript, superscript, nominator and denominator in PR #520: related documentation.

Signing & encrypting documents
-
since v2.5.6,
fpdf2allows to sign documents, using the companion endesive package: related documentation. -
since v2.6.1, and thanks to @andersonhc work in PR #609,
fpdf2allows to encrypt documents using RC4 or AES-128 algorithms: related documentation.
Annotations
-
since v2.5.7,
embed_file()&file_attachment_annotation()allow to embed other files into PDF documents: related documentation. -
FPDF.ink_annotation()has been introduced in v2.5.5 new to add path annotations: related documentation.

Documentation & translated tutorials
A demonstration Jupyter notebook has been created: tutorial/notebook.ipynb
New translations of our tutorial were also provided:
-
Simplified Chinese in PR #666 by @Bubbu0129: 简体中文
-
Bengali in PR #738 by @ssavi-ict: বাংলা
What's coming next?
We have several enhancement proposals open (and mostly "up-for-grabs"),
and also an handful of good first issues dedicated to developpers would like to start contributing to fpdf2 with a relatively easy task.
Among major projects, two contributors made very interesting & ambitious suggestions:
-
@gmischler has plans to enhance
fpdf2text-rendering capacities: discussion #339. At the moment he is working on a general solution for organizing flowing text withTextRegionclasses. -
@andersonhc suggested in discussion #696 to integrate the harfbuzz library to provide
fpdf2with text shaping abilities
Finally, I am seriously considering to move the fpdf2 project to the @py-pdf GitHub organization, in order to share ownership of several PDF-related Python libraries with other maintainers and join forces!
You can track this migration project and share your feedback in this GitHub discussion:
https://github.com/PyFPDF/fpdf2/discussions/752.
As always, I would be happy to receive your comments below 😊