You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cou can use an svg image as a logo ( @page { @top-right{ background-image: url("/static/logo.svg")}} ) and it works just fine.
But if the document has > 1 pages, the full SVG resource is included for every page in the pdfs, blowing up its size greatly. (100 pages includes the svg 100 times).
I also tried defining the logo as a svg-symbol with an id and then loading the id with svg-use, but that doesnt show up at all.
WeasyPrint Version: 60.1
The text was updated successfully, but these errors were encountered:
That’s right, when a SVG file is drawn multiple times, it’s included multiple times. That’s not the case for raster images, because a cache is used to avoid this, and we reference the PDF’s XObject each time the image is drawn. We should be able (hopefully) to store the drawing once in the PDF and reference it each time it’s required. But I don’t know yet which PDF structure to use for that.
I am experiencing the same issue. I generate documents with icons using an SVG spritesheet. However, it seems that the entire SVG is loaded each time an icon is retrieved:
background-image: url("./spritesheet.svg");
background-repeat: no-repeat;
background-size: 20px 20px;
From reading this discussion thread, I understand that the SVG is reloaded every time, which can result in a PDF document size of 4 MB for 14 pages. If I remove the icons entirely, the file size can decrease to 770 KB.
Is there a planned update for WeasyPrint to address this issue?
Is there a planned update for WeasyPrint to address this issue?
There’s nothing planned for this issue.
If you (or anyone) is interested in solving this issue, the first step is to find in the PDF specification a way to store the drawing once and reference it multiple times.
Cou can use an svg image as a logo ( @page { @top-right{ background-image: url("/static/logo.svg")}} ) and it works just fine.
But if the document has > 1 pages, the full SVG resource is included for every page in the pdfs, blowing up its size greatly. (100 pages includes the svg 100 times).
I also tried defining the logo as a svg-symbol with an id and then loading the id with svg-use, but that doesnt show up at all.
WeasyPrint Version: 60.1
The text was updated successfully, but these errors were encountered: