History¶
This project, fpdf2
is a fork of the PyFPDF
project, which can still be found on GitHub at reingart/pyfpdf, but has been totally inactive since January 2018, and has not seen any new release since 2015.
About the original PyFPDF
lib:
This project started as a Python fork of the FPDF PHP library, ported to Python by Max Pat in 2006: http://www.fpdf.org/dl.php?id=94. Later, code for native reading TTF fonts was added. The project aim is to keep the library up to date, to fulfill the goals of its original roadmap and provide a general overhaul of the codebase to address technical debt keeping features from being added and bugs to be eradicated. Until 2015 the code was developed at Google Code: you can still access the old issues, and old wiki.
How fpdf2 came to be¶
During the spring of 2016, David Ankin (@alexanderankin
) started a fork of PyFPDF, and added the first commit of what became fpdf2
: bd608e4. On May of 2017, the first release of fpdf2
was published on Pypi: v2.0.0.
On 2020, the first PRs were merged from external contributors. At the end of the year, Lucas Cimon (@Lucas-C) started contributing several improvements, in order to use fpdf2
for his Undying Dusk project. Version 2.1.0 was released and on 2021/01/10 fpdf2
was moved to a dedicated PyFPDF
GitHub organization, and @Lucas-C
became another maintainer of the project.
On 2023/08/04, fpdf2
moved to the py-pdf
organization: https://github.com/py-pdf/fpdf2. The context for this move can be found there: discussion #752. On this date, the PyFPDF
GitHub organization has been archived. The same month, Georg Mischler (@gmischler) and Anderson Herzogenrath da Costa (@andersonhc) joined the project as new maintainers.
Compatibility between PyFPDF & fpdf2¶
fpdf2
aims to be fully compatible with PyFPDF code.
The notable exceptions are:
- for the
cell()
method, the default value ofh
has changed. It used to be0
and is now set to the current value ofFPDF.font_size
- the font caching mechanism, that used the
pickle
module, has been removed, for security reasons, and because it provided little performance gain, and only for specific use cases - cf. issue #345. - Template elements now have a transparent background by default, instead of white
Some features are also deprecated. As of version 2.7.5 they still work but generate a warning when used:
- ⚠️ FPDF.rotate() can produce malformed PDFs: use FPDF.rotation() instead
- FPDF.set_doc_option(): simply set the
.core_fonts_encoding
property as a replacement - FPDF.dashed_line(): use FPDF.set_dash_pattern() and the normal drawing operations instead
- the
font_cache_dir
parameter of FPDF() constructor, that is currently ignored - the
uni
parameter of FPDF.add_font(), that is currently ignored: if the value of thefname
argument passed toadd_font()
ends with.ttf
, it is considered a TrueType font - the
type
parameter of FPDF.image(), that is currently ignored - the
dest
parameter of FPDF.output(), that is currently ignored - the
ln
parameter of FPDF.multi_cell(): usenew_x=
&new_y=
instead - the
split_only
parameter of FPDF.multi_cell(): usedry_run=True
andoutput="LINES"
instead - the HTMLMixin class: you can now directly use the FPDF.write_html() method
- the
infile
parametyer of Template() constructor, that is currently ignored - the parameters
x/y/w/h
ofcode39
elements provided to theTemplate
system: please usex1/y1/y2/size
instead - the
dest
parameter of Template.render(), that is currently ignored
Note that DeprecationWarning
messages are not displayed by Python by default. To get warned about deprecated features used in your code, you must execute your scripts with the -Wd
option (cf. documentation), or enable them programmatically with warnings.simplefilter('default', DeprecationWarning)
.