[reportlab-users] reducing filesize of created pdf
Robin Becker
robin at reportlab.com
Wed Jan 11 04:52:27 EST 2006
Jerome Alet wrote:
> On Tue, Jan 10, 2006 at 03:17:44PM -0800, Britt Hibbert wrote:
>
>>I apologize if this has been answered previously in the list, but
>>I could not locate any information on it in the docs or on the list.
>>Is there any way to reduce the filesize of the pdf that is created
>>by reportlab, perhaps by rendering at a reduced quality?
>
>
> You could use the beginForm/endForm/doForm methods when you have
> some repetitive things to do.
>
> Also if some images appear several times, use drawImage instead
> of drawInlineImage.
>
> These are two ways to save possibly very very huge disk space without
> reducing the quality.
>
> If you don't have repetitive things on your document, then I don't know
>
....
good points; ensure you have the pageCompression flag turned on in rl_config.py
and try to make images as small as possible. JPEGs seem to be the preferred
format. We put all images through a compression phase, but we lose native
compression modes for anything other than jpeg (because it has to be converted
into 2 3 or 4 width x height layers (ussually one byte/pixel). The compression
we use doesn't know about the images at all so can't take best advantage of them.
A minor saving can be had by changing the line DoComments = 1 in
pdfbase/pdfdoc.py to DoComments = 0
Using only standard fonts eliminates the embedding/subsetting cost of using
bespoke T1/TTF fonts.
--
Robin Becker
More information about the reportlab-users
mailing list