Fpdf2

Latest version: v2.7.9

Safety actively analyzes 642283 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 4 of 7

2.5.2

Added
- new parameters `new_x` and `new_y` for `cell()` and `multi_cell()`, replacing `ln=0`, thanks to gmischler
- new `highlight()` method to insert highlight annotations: [documentation](https://py-pdf.github.io/fpdf2/Annotations.html#highlights)
- new `offset_rendering()` method: [documentation](https://py-pdf.github.io/fpdf2/PageBreaks.html#unbreakable-sections)
- new `.text_mode` property: [documentation](https://py-pdf.github.io/fpdf2/TextStyling.html#text_mode)
- the page structure of the documentation has been revised, with a new page about [adding text](https://py-pdf.github.io/fpdf2/Text.html), thanks to gmischler
- a warning is now raised if a context manager is used inside an `unbreakable()` section, which is not supported
Changed
- `local_context()` can now "scope" even more properties, like `blend_mode`: [documentation](https://py-pdf.github.io/fpdf2/Images.html#blending-images)
Fixed
- No font properties should be leaked anymore after using markdown or in any other situations (_cf._ [359](https://github.com/py-pdf/fpdf2/issues/349)), thanks to gmischler
- If `multi_cell(align="J")` is given text with multiple paragraphs (text followed by an empty line) at once, it now renders the last line of each paragraph left-aligned,
instead of just the very last line (_cf._ [364](https://github.com/py-pdf/fpdf2/issues/364)), thanks to gmischler
- a regression: now again `multi_cell()` always renders a cell, even if `txt` is an empty string - _cf._ [349](https://github.com/py-pdf/fpdf2/issues/349)
- a bug with string width calculation when Markdown is enabled - _cf._ [351](https://github.com/py-pdf/fpdf2/issues/351)
- a few bugs when parsing some SVG files - _cf._ [356](https://github.com/py-pdf/fpdf2/issues/356), [#358](https://github.com/py-pdf/fpdf2/issues/358) & [#376](https://github.com/py-pdf/fpdf2/issues/376)
- a bug when using `multi_cell(..., split_only=True)` inside an `unbreakable` section - _cf._ [359](https://github.com/py-pdf/fpdf2/issues/359)
Deprecated
- The parameter `ln` to `cell()` and `multi_cell()` is now deprecated: use `new_x` and `new_y` instead.
- The parameter `center` to `cell()` is now deprecated, use `align="C"` instead.

2.5.1

Added
- The documentation outline is revised, and a page about creating Text added, thanks to gmischler
- support for soft-hyphen (`\u00ad`) break in `write()`, `cell()` & `multi_cell()` calls - thanks oleksii-shyman & gmischler!
Documentation: [Line breaks](https://py-pdf.github.io/fpdf2/LineBreaks.html)
- new documentation page on [Emojis, Symbols & Dingbats](https://py-pdf.github.io/fpdf2/EmojisSymbolsDingbats.html)
- documentation on combining `borb` & `fpdf2`: [Creating a borb.pdf.document.Document from a FPDF instance](https://py-pdf.github.io/fpdf2/borb.html)

Changed
- `write()` now supports soft hyphen characters, thanks to gmischler
- `fname` is now a required parameter for `FPDF.add_font()`
- `image()` method now insert `.svg` images as PDF paths
- the [defusedxml](https://pypi.org/project/defusedxml/) package was added as dependency in order to make SVG parsing safer
- log level of `_substitute_page_number()` has been lowered from `INFO` to `DEBUG`

Fixed
- a bug when rendering Markdown and setting a custom `text_color` or `fill_color`
- a bug in `get_string_width()` with unicode fonts and Markdown enabled,
resulting in calls to `cell()` / `multi_cell()` with `align="R"` to display nothing - thanks mcerveny for the fix!
- a bug with incorrect width calculation of markdown text

Deprecated
- 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](https://github.com/py-pdf/fpdf2/issues/345).
That means that the `font_cache_dir` optional parameter of `fpdf.FPDF` constructor
and the `uni` optional argument of `FPDF.add_font()` are deprecated.
The `fpdf.fpdf.load_cache` function has also been removed.

To be extra clear: `uni=True` can now be removed from all calls to `FPDF.add_font()`.
If the value of the `fname` argument passed to `add_font()` ends with `.ttf`, it is considered a TrueType font.

2.5.0

Not secure
Added
Thanks to torque for contributing this massive new feature:
- add [`fpdf.drawing`](https://py-pdf.github.io/fpdf2/Drawing.html) API for composing paths from an arbitrary sequence of lines and curves.
- add [`fpdf.svg.convert_svg_to_drawing`](https://py-pdf.github.io/fpdf2/SVG.html) function to support converting basic scalable vector graphics (SVG) images to PDF paths.

Fixed
- `will_page_break()` & `accept_page_break` are not invoked anymore during a call to `multi_cell(split_only=True)`
- Unicode characters in headings are now properly displayed in the table of content, _cf._ [320](https://github.com/py-pdf/fpdf2/issues/320) - thanks lcomrade

2.4.6

Not secure
Added
- New `FPDF.pages_count` property, thanks to paulacampigotto
- Temporary changes to graphics state variables are now possible using `with FPDF.local_context():`, thanks to gmischler
- a mechanism to detect & downscale oversized images,
_cf._ [documentation](https://py-pdf.github.io/fpdf2/Images.html#oversized-images-detection-downscaling).
[Feedbacks](https://github.com/py-pdf/fpdf2/discussions) on this new feature are welcome!
- New `set_dash_pattern()`, which works with all lines and curves, thanks to gmischler.
- Templates now support drawing ellipses, thanks to gmischler
- New documentation on how to display equations, using Google Charts or `matplotlib`: [Maths](https://py-pdf.github.io/fpdf2/Maths.html)
- The whole documentation can now be downloaded as a PDF: [fpdf2-manual.pdf](https://py-pdf.github.io/fpdf2/fpdf2-manual.pdf)
- New sections have been added to [the tutorial](https://py-pdf.github.io/fpdf2/Tutorial.html), thanks to portfedh:

5. [Creating Tables](https://py-pdf.github.io/fpdf2/Tutorial.html#tuto-5-creating-tables)
6. [Creating links and mixing text styles](https://py-pdf.github.io/fpdf2/Tutorial.html#tuto-6-creating-links-and-mixing-text-styles)
- New translation of the tutorial in Hindi, thanks to Mridulbirla13: [हिंदी संस्करण](https://py-pdf.github.io/fpdf2/Tutorial-hi.html); [Deutsch](https://py-pdf.github.io/fpdf2/Tutorial-de.html), thanks to digidigital; and [Italian](https://py-pdf.github.io/fpdf2/Tutorial-it.html) thanks to xit4; [Русский](https://py-pdf.github.io/fpdf2/Tutorial-ru.html) thanks to AABur; and [português](https://py-pdf.github.io/fpdf2/Tutorial-pt.html) thanks to fuscati; [français](https://py-pdf.github.io/fpdf2/Tutorial-fr.html), thanks to Tititesouris
- While images transparency is still handled by default through the use of `SMask`,
this can be disabled by setting `pdf.allow_images_transparency = False`
in order to allow compliance with [PDF/A-1](https://en.wikipedia.org/wiki/PDF/A#Description)
- [`FPDF.arc`](https://py-pdf.github.io/fpdf2/fpdf/fpdf.html#fpdf.fpdf.FPDF.arc): new method added.
It enables to draw arcs in a PDF document.
- [`FPDF.solid_arc`](https://py-pdf.github.io/fpdf2/fpdf/fpdf.html#fpdf.fpdf.FPDF.solid_arc): new method added.
It enables to draw solid arcs in a PDF document. A solid arc combines an arc and a triangle to form a pie slice.
- [`FPDF.regular_polygon`](https://py-pdf.github.io/fpdf2/fpdf/fpdf.html#fpdf.fpdf.FPDF.regular_polygon): new method added, thanks to bettman-latin
Fixed
- All graphics state manipulations are now possible within a rotation context, thanks to gmischler
- The exception making the "x2" template field optional for barcode elements did not work correctly, fixed by gmischler
- It is now possible to get back to a previous page to add more content, _e.g._ with a 2-column layout, thanks to paulacampigotto
Changed
- All template elements now have a transparent default background instead of white, thanks to gmischler
- To reduce the size of generated PDFs, no `SMask` entry is inserted for images that are fully opaque
(= with an alpha channel containing only 0xff characters)
- The `rect`, `ellipse` & `circle` all have a `style` parameter in common.
They now all properly accept a value of `"D"` and raise a `ValueError` for invalid values.
Deprecated
- `dashed_line()` is now deprecated in favor of `set_dash_pattern()`

2.4.5

Not secure
Fixed
- ensure support for old field names in `Template.code39` for backward compatibility

2.4.4

Not secure
Added
- `Template()` has gained a more flexible cousin `FlexTemplate()`, _cf._ [documentation](https://py-pdf.github.io/fpdf2/Templates.html), thanks to gmischler
- markdown support in `multi_cell()`, thanks to Yeshi Namkhai
- base 64 images can now be provided to `FPDF.image`, thanks to MWhatsUp
- documentation on how to generate datamatrix barcodes using the `pystrich` lib: [documentation section](https://py-pdf.github.io/fpdf2/Barcodes.html#datamatrix),
thanks to MWhatsUp
- `write_html`: headings (`<h1>`, `<h2>`...) relative sizes can now be configured through an optional `heading_sizes` parameter
- a subclass of `HTML2FPDF` can now easily be used by setting `FPDF.HTML2FPDF_CLASS`,
_cf._ [documentation](https://py-pdf.github.io/fpdf2/DocumentOutlineAndTableOfContents.html#with-html)
Fixed
- `Template`: `split_multicell()` will not write spurious font data to the target document anymore, thanks to gmischler
- `Template`: rotation now should work correctly in all situations, thanks to gmischler
- `write_html`: headings (`<h1>`, `<h2>`...) can now contain non-ASCII characters without triggering a `UnicodeEncodeError`
- `Template`: CSV column types are now safely parsed, thanks to gmischler
- `cell(..., markdown=True)` "leaked" its final style (bold / italics / underline) onto the following cells
Changed
- `write_html`: the line height of headings (`<h1>`, `<h2>`...) is now properly scaled with its font size
- some `FPDF` methods should not be used inside a `rotation` context, or things can get broken.
This is now forbidden: an exception is now raised in those cases.
Deprecated
- `Template`: `code39` barcode input field names changed from `x/y/w/h` to `x1/y1/y2/size`

Page 4 of 7

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.