Reputation: 90831
Can I programatically change the quality of a PDF?
I have a client that is a newspaper, and when they submit the PDF form of the paper to their site they are submitting the same copy they send to the printer which can range from 30-50Mb. I can manually lower the quality (still plenty high for the web) and it will be 3-5Mb so this will help my hosting substantially.
Upvotes: 0
Views: 570
Reputation: 4536
That seems like something that would require nothing short of the Adobe PDF SDK / libraries. I have worked with them quite bit, but I have never attempted to change the resolution of an existing PDF. The libraries are pricey so it's likely that is not an option for you.
I want to say that Perl's PDF::API2 has an optimize script bundled with it, but I have never used that functionality. It may be worth a look. The module itself is pretty thorough. Although, a PDF that large not be that fastest to process with it.
Upvotes: 1
Reputation: 7712
Zend_Pdf is the best Free library for reading and manipulating existing PDFs, but it does not go nearly deep enough to do what you need. I do not believe there is a PHP library for manipulating PDF files at that level (that is, being able to extract embedded images and replace them with lower quality versions).
Upvotes: 0
Reputation: 5348
You should check TCPDF library or php documentation. I never worked with pdfs in php, but I think you can do that you need with TCPDF easily. If your pdf is composed by images, check this example, maybe help you.
Regards
Upvotes: 0