Re: Reducing PDF File Size

Robin Becker <[email protected]> Wed, 23 Mar 2022 18:27:21 +0000
Newsgroups gmane.comp.python.reportlab.user
Message-ID <[email protected]>
On 23/03/2022 07:13, Lele Gaifax wrote:
> Joseph Dvorak <[email protected]> writes:
> 
>> I have a document with 4 pages, each having an image page .png background.
>> [...]
>>
>> ReportLab generates a document file of 3.4 MB.
>>
>> How can I *significantly* reduce the size of the PDF file within ReportLab?
> 
> Try converting those PNGs to JPGs: AFAICT, PDF has a specialized reader for
> JPGs, while other formats are stored in base64/base85.
> 
> ciao, lele.

In fact non-jpeg images are now mostly stored with 'Flate' compression

self.streamContent = zlib.compress(raw)

We used to use A85 to try and avoid lots of binary content in the file as old style mailers used to corrupt them.

The image sizes may dominate gilsize because people use high resolution images.
-- 
Robin Becker