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

Yannick Gosteli @ PETZI yannick.gosteli at petzi.ch
Wed Nov 15 16:23:25 EST 2017


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



More information about the reportlab-users mailing list