Log in

View Full Version : How to create PDF file with high res photo's using PHP 4.0



KeenOwl
02-12-2008, 06:10 AM
Friends,

I need your help. I run a website called KeenOwl Books (http://www.keenowl.com) that creates personalized life lesson childrens storybooks. Part of our personalization includes allowing customers to upload a photograph or image that is integrated into the printed storybook, along with other values for this specific customers personalization choices.

We are using PHP 4.0 (as I am hosted on Yahoo!) and using a freeware PDF creation module (FPDF - see http://www.fpdf.org for more) that uses PHP to generate PDF files on the fly. However, the image or photo seems to be integrated into the dynamic PDF file at 72 DPI, even when the source images were at 100 DPI or higher. This results in pixelated images/photos in the resultant PDF file and of course, unhappy customers.

Any idea on how one can integrate higher res images (e.g. 300 DPI) images into a dynamically generated PDF file AND preserve its resolution? Again, we are currently hosted on Yahoo using PHP 4.0. Need more info? let me know.

Thanks all,

Aaron
02-12-2008, 09:29 AM
I've never done it. but ... recently started playing around with ImageMagick. It is command line type tool with ports on many OS, including two listed for PHP. Seems very powerful. It claims to read pdf with help of Ghostscript. If you can read the pdf, then you can convert it to other format like jpg which you might be able to implement easier for your application.

I first learned of this ImageMagick reading a webpage where some map site was using png from inkscape and then processing thru imagemagick. Output was nice. So I tried with the windows binary and got nice result too, but file is larger then I wanted. Had to do additional processing in Gimp to reduce size. Image quality was terrific.

For your application, if you can get these tools on your server then perhaps? Again, I've never tried.