[cairo] Size of PDF with lots of images

Oswaldo listas at soft-com.es
Thu Jan 16 07:37:40 PST 2014

El 16/01/2014 4:44, Behdad Esfahbod escribió:
> Back in 2007 Carl and I developed Slippy a GUADEC to do our cairo slides.  I
> have used it since for many presentations.  It's a pycairo-based tool where
> you express slides as Python functions.  It's very handy, specially if you
> want to use cairo drawing in your slides.
> Back in the days, if I had a huge background image, it was replicated in each
> slide, so I was getting, like, 240MB PDFs for a simple presentation.
> Fortunately that has long been fixed.
> Now, for my GLyphy talk [2], the source images are 14MB [3], but the generated
> PDF [4] is 18MB.  Does anyone feel like taking a look?
> [1] http://github.com/behdad/slippy
> [2] https://vimeo.com/83732058
> [3] https://github.com/behdad/slippy/tree/master/glyphy
> [4] http://behdad.org/glyphy_slides.pdf


I do not know if your problem is this:

I also use pyCairo to generate PDFs and when I used the same image on 
multiple pages (logos, backgrounds, etc) the pdf file was too large 
because if i use the same image ten times the image was embedded ten 
times in the pdf file.

I solved it creating an image cache surface object, then, before create 
a new image surface I search the cache and, if exists on it, I reuse the 
previous created surface. In this way image was embedded only once.


More information about the cairo mailing list