Page 1 of 1

Problem converting PDF to JPG for Flash Flipbook app

Posted: 2008-12-07T19:19:11-07:00
by spin
Hi everyone,

We are having a problem creating a Flash Flipbook from PDF using the command line of IM in a PHP / MySQL Web application. The flipbook app does not support PDF inputs so we must convert it to JPG or PNG, etc. When we convert the files we are getting horrible results.

I have read various posts trying to avoid posting here, but I'm a bit lost at this point. I am not personally a programmer, but I'm trying to find possible solutions for my programming team that is working on this project, so I apologize for any lack of any info you may need.

It seems the problems could stem from various issues ranging from CMYK to layered postscript files given this is dealing with print resolution PDF files. This is a very important project, and I'm even willing to pay a reasonable fee to an expert on the forum that might be interested in personally working on troubleshooting and resolving this imagemagick issue directly for us (you can mail me at daren@zouth.com if interested).

Otherwise, thanks in advance to anyone that can reply and make suggestions on how a properly formatted script for PDF conversion should look.

The code we are now using inside our PHP file, which seems to not be working, is: exec("/usr/local/bin/convert -depth 100 -normalize -quality 100 ".$uploaddir."/".$file." ".$uploaddir."/".$ext_array.".jpg");

BEFORE THIS . . . I think the code we tried was: exec("/usr/local/bin/convert -depth 10 -density 400 -normalize ".$uploaddir."/".$file." -quality 100 ".$uploaddir."/".$ext_array.".jpg");

The results for that, if correct, were: http://www.zouth.com/flipbook/Heater/

You can see the images and the PDF we started with. These are all before the flipbook even processed them. If I have the code wrong from the actual output, at least this is the best output we have been able to get from our various trials.

Thanks in advance!

Re: Problem converting PDF to JPG for Flash Flipbook app

Posted: 2008-12-07T19:53:52-07:00
by el_supremo
The -depth won't have any useful effect. I'd suggest that you output in PNG format to avoid any artifacts caused by JPG compression.
I used this command to extract the first page:

Code: Select all

convert -density 200 waterheater.pdf\[0\] waterheater-0.png
and it produces very readable text. You might be able to get away with a lower density (say, 150) but you'd have to play with it.

Try this:

Code: Select all

exec("/usr/local/bin/convert -density 200 ".$uploaddir."/".$file." ".$uploaddir."/".$ext_array.".png");
Pete

Re: Problem converting PDF to JPG for Flash Flipbook app

Posted: 2008-12-08T08:59:10-07:00
by spin
Thanks so much! I'm going to ask my developer to look at your notes and give this a try. I actually tried this myself, but there was something with our code not allowing it to output PNG files. I think it is related to the settings for the Flash Flipbook app. We'll check this in about an hour or so.

One thing I did want to ask - we are going to be using this for very large PDF files that are for printing. We want to render proofs into the Flash Flipbook basically. Can you give me any idea if this is going to be a problem? I am concerned about server load and time to render a file that is say 100MB in size and 40 pages from a PDF into the PNG images. Thoughts? Also, will I run into sizing / formatting issues once this thing is working? The reason I ask is that we will have various size PDFs of 300 DPI (magazines, brochures, etc.), as not every page will be the same size. I am wondering if this will require us to create any manual manipulation from the administrator before the code is executed each time (as in setting the input doc size, resolution, etc.).

Thanks again for your help.

Daren