[reportlab-users] Integrate "Flowable" (SVG) with caching

Dinu Gherman gherman at darwin.in-berlin.de
Thu Nov 16 07:57:27 EST 2017


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 <yannick.gosteli at petzi.ch>:
> 
> 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
> yannick.gosteli at petzi.ch
> www.petzi.ch - www.petzitickets.ch
> 
> _______________________________________________
> reportlab-users mailing list
> reportlab-users at lists2.reportlab.com
> https://pairlist2.pair.net/mailman/listinfo/reportlab-users



More information about the reportlab-users mailing list