[reportlab-users] How to make smaller PDF?

Robin Becker reportlab-users@reportlab.com
Fri, 23 Jul 2004 10:34:13 +0100


Andy Robinson wrote:

>>PDFs I make here are ~24kb for the first page, and that includes a logo.
>>Subsequent pages are only a few kb each. If I use any custom PostScript
>>fonts, the size goes up massively (IIRC, about 700Kb for the first
>>page). It appears that ReportLab does not subset the embedded font, and
>>an entire PostScript font is not small so this would explain it.
> 
> 
> Yes, but we only include a font once per file.  50kb for each of 4 fonts
> is a big overhead on a 2-page invoice but not a problem for a 1000-page
> manual.
> 
> - Andy
.... as a confirmation I changed one of the test_pdfbase_ttfonts tests to allow 
generation of 1 or 3 page document with the same characters used. The font 
descriptors are created just once as needed and seem to be reused.

The 1 page form is 107k, the 3 page document is 130k. As an additional aside I 
note that ttf fonts are delayed objects and are implemented once only at the end 
of the pdf generation.
-- 
Robin Becker