FPDF.bezier() to render quadratic and cubic Bézier curves, and many improvements
Note: a temporary 2.8.0 version was released but then erroneously removed on Pypi.
Versions 2.8.0 & 2.8.1 are exactly the same.
Added
- support for quadratic and cubic Bézier curves with
FPDF.bezier()
- thanks to @awmc000 - support for escape character for markers in markdown text issue #1215
- Wrapping words on spaces now considers all common space symbols in addition to regular spaces (' '), addressing issues with word-wrapping for languages like Thai, as per #1190 and #1191.
Templates
can now be also defined in JSON files.- support to optionally set
wrapmode
in templates (default"WORD"
can optionally be set to"CHAR"
to support wrapping on characters for scripts like Chinese or Japanese) - cf. #1159 - thanks to @carlhiggs - documentation on how to use
fpdf2
with Rough.js: link to docs - documentation on how to use
fpdf2
with gunicorn: link to docs - new translation of the tutorial in Türkçe, thanks to @Natgho: Türkçe
- feature to identify the Unicode script of the input text and break it into fragments when different scripts are used, improving text shaping results
FPDF.image()
: now handleskeep_aspect_ratio
in combination with an enum value provided tox
FPDF.write_html()
: now supports CSS page breaks properties : documentationFPDF.write_html()
: new optionalfont_family
parameter to set the default font familyFPDF.write_html()
: spacing before lists can now be adjusted via thetag_styles
attribute - thanks to @lcgeneralprojects- file names are mentioned in errors when
fpdf2
fails to parse a SVG image
Fixed
FPDF.local_context()
used to leak styling during page breaks, when renderingfooter()
&header()
- MR: #1207fpdf.drawing.DeviceCMYK
objects can now be passed toFPDF.set_draw_color()
,FPDF.set_fill_color()
andFPDF.set_text_color()
without raising aValueError
: documentation.FPDF.write_html()
: fixing rendering of<hr>
tags, that do not trigger a page break anymoreFPDF.write_html()
: fixed automatic page break when an image does not have enough vertical space to be rendered on a page- individual
/Resources
directories are now properly created for each document page. This change ensures better compliance with the PDF specification but results in a slight increase in the size of PDF documents. You can still use the old behavior by settingFPDF().single_resources_object = True
- line size calculation for fragments when text shaping is used
FPDF.write_html()
: fixed incoherent indentation of long<ul>
list entries - cf. issue #1073 - thanks to @lcgeneralprojects- default values for
top_margin
andbottom_margin
inHTML2FPDF._new_paragraph()
calls are now correctly converted into chosen document units. - In text_columns(), paragraph top/bottom margins didn't correctly trigger column breaks; issue #1214
fpdf.drawing.color_from_hex_string
did not test or mention accepting lowercase hex values.- handling of bidirectional text on
FPDF.get_string_width()
[issue #1231] - new translation of the tutorial in Indonesian - thanks to @odhyp
RecursionError
in some cases when callingFPDF.write_html()
insideFPDF.footer()
- issue #1222
Removed
- support for Python 3.7, that reached end-of-life in 2023
- an obscure and undocumented feature of
FPDF.write_html()
, which used to magically pass instance attributes as arguments.
Deprecated
fpdf.TitleStyle
has been renamed intofpdf.TextStyle
FPDF.write_html()
:tag_indents
introduced in the last version - Now the indentation can be provided through thetag_styles
parameter, using the.l_margin
ofTextStyle
instances
Changed
FPDF.local_context()
used to treatfont_size
as a value in points. Now this is the role offont_size_pt
, whereasfont_size
allows to set the font size into chosen document units (specified withFPDF(unit=)
) - MR: #1207FPDF.circle()
: the previousr
parameter, that in fact defined the diameter, has been replaced by a newradius
paremeter. Thex
&y
parameters now define the circle center, instead of its top-left corner as it used to be - issue #1245FPDF.table()
now raises an error when a single row is too high to be rendered on a single pageFPDF.write_html()
: indentation of HTML elements can now be non-integer (float), and is now independent of font size and bullet strings.- improved performance of font glyph selection by using functools cache
- Clarified usage of the
style
attribute inFPDF.add_font()