Open reknih opened 2 years ago
I suspected that, but I personally just use this to create maps and to instantiate SVG symbols in my map (without bloating the file size):
For my purpose it's okay, since I only use simple symbols (basic paths, etc.). Right now I don't need to support gradients or complex symbols, it's just important that I can use the SVG format, so that I can edit symbol sets using an SVG editor.
Thanks for making svg2pdf by the way, placing SVG symbols in the map was the last problem I had with putting a proper map together.
Is there a way to mitigate that ? by a transformation of the source SVG by any chance ? I'd like to use an SVG in printpdf which doesn't render well, while svg2pdf renders it correctly.
Hi Felix, I could not help but notice that you recently added SVG support to
printpdf
using mysvg2pdf
crate (thanks!).Converting an SVG to a PDF often requires more than a single content stream/object.
svg2pdf
heavily uses the/Do
operator to draw other XObjects and references many objects through theResources
dictionary of the page.printpdf
currently discards all of thesvg2pdf
output except for the main content stream.This means that SVGs using the features listed below will produce content streams with broken references:
To fix this,
printpdf
would have to collect all objects in thePage
'sResources
dictionary and theResources
dictionary of all referenced XObjects recursively and carry them over to the target file.In order to reproduce the bug, I converted the attached SVG to a PDF file with
printpdf
and a standalonesvg2pdf
setup. Theprintpdf
result cannot be opened in Acrobat and only shows a solid orange rectangle in Pdfium while thesvg2pdf
output reproduces the output of an SVG viewer.The original SVG (on OneDrive because GitHub does not allow the file format in issues) The
printpdf
result (pardon the margins) Thesvg2pdf
result