[reportlab-users] PDF Report size too large

Jean-Yves F. Barbier 12ukwn at gmail.com
Sat Jan 21 00:59:26 EST 2012


On Sat, 21 Jan 2012 05:15:14 +0000
Asif Jamadar <asif.jamadar at rezayat.net> wrote:

Hi Asif,


> I'm using Reportlab tool to generate dynamic PDF.

> The generated PDF consist of 1 or 2 pages but the size this PDF

> reached to 5 MB. How can I decrease the size of the generate PDF.


What do you put in it? (large images, many different fonts, ...?)


> I want to decrease the size to max 500 KB.

> IS there any way to accomplish this thing in reportlab?


You have 'setPageCompression', as in:
self.canvas.setPageCompression( 1 )
but you won't gain a lot (~15-20% max) because PDF data
isn't easy to compress (ie: trying to bzip2 an already
compressed RL issued PDF of 263,251 bytes lead to
234,714 bytes).

JY
--
Art is a lie which makes us realize the truth.
-- Picasso


More information about the reportlab-users mailing list