[Gambas-user] How to reduce the size of PDFs generated with PDFSurface/Cairo

BB adamnt42 at gmail.com
Mon Oct 9 10:09:22 CEST 2023


On 30/9/23 1:05 am, Claus Dietrich wrote:
>
> Hi
>
> I am using the Gambas PDFSurface and Cairo to generate and assemble 
> multi-page PDFs.
>
> When I insert a jpg-image from my scanner (A4 size, 300dpi, 90% 
> quality) with a size of 730 kB  the resulting single page PDF is blown 
> up to a size of 2.8 MB. A stripped down demo project is attached:
>
> https://send.vis.ee/download/62247b9c0d0529a1/#JidKAJn64IdF4G1c-4B07A
>
> Does anyone know a way to obtain a PDF file with a similar size (resp. 
> compression) like the source image by using native Gambas means 
> (=without installing tools like ImageMagick)?
>
> Best regards
>
> Claus
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----

Hi Claus, I don't see that you ever got a reply on this, so just a bit 
of information from me on it. I don't know how you could reduce the size 
as from my "memory" pdf used to and maybe still does include all kinds 
of images as a dot-by-dot set of "portable" print instructions. That is 
for each image pixel it creates approximately 4 pdf (byte code) 
statements. Years ago I remember I had to tell the (ahem) "less 
experienced" graphics designers never to use any shade of yellow in 
their pictures as that blew the pdf size out by about 64 bytes per pixel 
i.e about 32 times the size of the image. So 4 times the original image 
size would be a "good outcome" in my opinion. As far as I know pdf still 
doesn't know fig-all about image formats.

hth

b

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20231009/571c2a45/attachment.htm>


More information about the User mailing list