Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reduce the size of PDF file generated with Quartz2D

I'm looking for a way to reduce PDF size that I generate with Quartz. I'm drawing images with CGContextDrawImage in a CGPDFContext. What I'm afraid of is that the images are saved as Bitmap and not JPEG. Is there a way to check for that and a way to control that when writing the PDF?

I also tried reducing downscaling the image before writing it to the PDF context but I end up with an even larger file (although the page size in pixels is smaller).

Thanks!

like image 569
Kamchatka Avatar asked Jul 19 '10 01:07

Kamchatka


People also ask

How do I reduce the size of a PDF drastically?

In the latest version of Adobe Acrobat, open the PDF you wish to re-save as a smaller file, choose File, Save as Other, and then Reduced Size PDF. You'll be prompted to select the version compatibility you need — it defaults to Retain existing to keep the current file settings — and then you can click OK to save.


1 Answers

There is no public API for setting CGPDFContext's image compression settings.

like image 168
rpetrich Avatar answered Sep 20 '22 02:09

rpetrich