Releases: py-pdf/fpdf2
Releases · py-pdf/fpdf2
Document outline & table of contents
Added
- new features: document outline & table of contents! Check out the new dedicated documentation page for more information
- new method
text_annotation
to insert... Text Annotations FPDF.image
now also accepts anio.BytesIO
as input
Fixed
HTMLMixin
/HTML2FPDF
: properly handling<img>
inside<td>
& allowing to center them horizontally
set_xmp_metadata & customizable <li> bullets & indentation
Added
FPDF.set_xmp_metadata
- made
<li>
bullets & indentation configurable through class attributes, instance attributes or optional method arguments, cf.test_customize_ul
Fixed
FPDF.multi_cell
: line wrapping with justified content and unicode fonts, cf. #118FPDF.multi_cell
: whenln=3
, automatic page breaks now behave correctly at the bottom of pages
Polygons, accessibility & structure tree
Added
FPDF.polyline
&FPDF.polygon
: new methods added by @uovodikiwi - thanks!FPDF.set_margin
: new method to set the document right, left, top & bottom margins to the same value at onceFPDF.image
now accepts new optionaltitle
&alt_text
parameters defining the image title
and alternative text describing it, for accessibility purposesFPDF.link
now honor itsalt_text
optional parameter and this alternative text describing links
is now properly included in the resulting PDF document- the document language can be set using
FPDF.set_lang
Fixed
FPDF.unbreakable
so that no extra page jump is performed whenFPDF.multi_cell
is called inside this context
Deprecated
fpdf.FPDF_CACHE_MODE
&fpdf.FPDF_CACHE_DIR
in favor of a configurable newfont_cache_dir
optional argument of thefpdf.FPDF
constructor
Unbreakable!
Many thanks to @eumiro & @fbernhart for their contributions to make fpdf2
cleaner!
Check this blog post for an explanation on this release name.
Added
FPDF.unbreakable
: a new method providing a context-manager in which automatic page breaks are disabled.
cf. https://pyfpdf.github.io/fpdf2/PageBreaks.htmlFPDF.epw
&FPDF.eph
: new@property
methods to retrieve the effective page width / height, that is the page width / height minus its horizontal / vertical margins.FPDF.image
now accepts also aPillow.Image.Image
as inputFPDF.multi_cell
parameters evolve in order to generate tables with multiline text in cells:- its
ln
parameter now accepts a value of3
that sets the new position to the right without altering vertical offset - a new optional
max_line_height
parameter sets a maximum height of each sub-cell generated
- its
- new documentation pages : how to add content to existing PDFs, HTML, links, tables, text styling & page breaks
- all PDF samples are now validated using 3 different PDF checkers
Fixed
FPDF.alias_nb_pages
: fixed this feature that was broken since v2.0.6FPDF.set_font
: fixed a bug where calling it several times, with & without the same parameters,
prevented strings passed first to the text-rendering methods to be displayed.
Deprecated
- the
dest
parameter ofFPDF.output
method
New minor version: 2.2
Added
- new unit tests, a code formatter (
black
) and a linter (pylint
) to improve code quality - new boolean parameter
table_line_separators
forHTMLMixin.write_html
& underlyingHTML2FPDF
constructor
Changed
- the documentation URL is now simply https://pyfpdf.github.io/fpdf2/
Removed
- dropped support for external font definitions in
.font
Python files, that relied on a call toexec
Deprecated
- the
type
parameter ofFPDF.image
method - the
infile
parameter ofTemplate
constructor - the
dest
parameter ofTemplate.render
method