Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: SVG optimization #1350

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ This can also be enabled programmatically with `warnings.simplefilter('default',
### Added
* support for [shading patterns (gradients)](https://py-pdf.github.io/fpdf2/Patterns.html)
* support for strikethrough text
* Improved SVG image speed by 50% to 70% - thanks to @petri-lipponen-movesense - [PR #1350](https://github.com/py-pdf/fpdf2/pull/1350)
### Fixed
* [`FPDF.write_html()`](https://py-pdf.github.io/fpdf2/fpdf/fpdf.html#fpdf.fpdf.FPDF.write_html): Fixed rendering of content following `<a>` tags; now correctly resets emphasis style post `</a>` tag: hyperlink styling contained within the tag authority. - [Issue #1311](https://github.com/py-pdf/fpdf2/issues/1311)

Expand Down
10 changes: 5 additions & 5 deletions fpdf/svg.py
Original file line number Diff line number Diff line change
Expand Up @@ -917,15 +917,15 @@ def build_group(self, group, pdf_group=None):
if child.tag in xmlns_lookup("svg", "defs"):
self.handle_defs(child)
elif child.tag in xmlns_lookup("svg", "g"):
pdf_group.add_item(self.build_group(child))
pdf_group.add_item(self.build_group(child), False)
elif child.tag in xmlns_lookup("svg", "path"):
pdf_group.add_item(self.build_path(child))
pdf_group.add_item(self.build_path(child), False)
elif child.tag in shape_tags:
pdf_group.add_item(self.build_shape(child))
pdf_group.add_item(self.build_shape(child), False)
elif child.tag in xmlns_lookup("svg", "use"):
pdf_group.add_item(self.build_xref(child))
pdf_group.add_item(self.build_xref(child), False)
elif child.tag in xmlns_lookup("svg", "image"):
pdf_group.add_item(self.build_image(child))
pdf_group.add_item(self.build_image(child), False)
else:
LOGGER.warning(
"Ignoring unsupported SVG tag: <%s> (contributions are welcome to add support for it)",
Expand Down