Re: Integrate "Flowable" (SVG) with caching
Dinu Gherman <[email protected]>
| Newsgroups | gmane.comp.python.reportlab.user |
|---|---|
| Message-ID | <[email protected]> |
Hi Yannick, have you tried using svglib that I originally wrote in the context of reportlab? Using it you can import an SVG file and render it as a reportlab flowable. I’m just not sure if it will be cached and reused the same way as bitmap images over many pages. And I haven’t really produced reportlab-generated docs in a long time. https://github.com/deeplook/svglib Cheers, Dinu > Am 15.11.2017 um 22:23 schrieb Yannick Gosteli @ PETZI <[email protected]>: > > Dear, > > I generate a document that contains a SVG repeated several times. > I wonder if there is a way to integrate this SVG with "caching" the same way it works with Canvas.drawImage*. > > My problem is the PDF file size blows up when I integrate a SVG dozens or even hundreds times. > I "abstracted" my problem here: https://github.com/Gostich/reportlab_test_svg/blob/master/test.py > > I currently found a workaround that is not that bad by rendering my SVG into a PIL image and then use Canvas.drawImage. > You can check my workaroud here: https://github.com/Gostich/reportlab_test_svg/blob/master/test2.py > > Does anybody has a better way to do that? > > Best regards > Yannick > > * From the reportlab userguide about Canvas.drawImage: "However, we use a caching system; a given image will only be stored the first time it is used, and just referenced on subsequent use" > > -- > Yannick Gosteli > PETZI - Association suisse des clubs de musiques actuelles > Billetterie/Petzitickets > [email protected] > www.petzi.ch - www.petzitickets.ch > > _______________________________________________ > reportlab-users mailing list > [email protected] > https://pairlist2.pair.net/mailman/listinfo/reportlab-users _______________________________________________ reportlab-users mailing list [email protected] https://pairlist2.pair.net/mailman/listinfo/reportlab-users