Forum How do I...?

Prince pdf with images file size

nico
Hello,

I am trying to use Prince to create PDF files that contains scanned images only. These images are typically saved in TIFF CCITT Group 4 fax encoding format. The idea is to be able to share multipage scanned documents easily. So these documents have no text inside, only pictures.

Now the problem is that the PDF file is always a lot bigger than the sum of the image file sizes. For example I used 3 images of total size 43 kB to get a PDF file of 113 kB. So 2.6 times bigger.

I would like to know if there is a way to tell Prince to handle the images differently so that the final PDF size is comparable to the sum of the image file sizes.

I could also change the images encoding format. But which one would be best then ?

I saw that Prince allows to attach files inside the PDF with the --attach flag. And in this case the final size is OK. But still I don't know if it is possible to display the images.

Regards,

Nicolas
mikeday
Currently Prince embeds images in PDF files using JPEG encoding or PNG encoding, and does not know about TIFF CCITT Group 4 fax encoding. As a result, the images will be re-encoded in a format that takes more space. We may be able to add support for this image format to a future release of Prince.
nico
Thank you for your answer.

It would be nice to add support for TIFF CCITT Group 4 fax encoding format. It is a good choice for scanned documents that contain text mostly.

You say that images are re-encoded in PNG or JPEG. Can you explain how Prince decides which format will be chosen? And which settings you apply (compression level, ...)?

Regards,

Nicolas
mikeday
Basically JPEG images are embedded as-is, all other images are decoded and compressed using the built-in PDF "deflate" mechanism, which is similar to PNG.