Php and converting PDF's with IM

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
dstokes

Php and converting PDF's with IM

Post by dstokes »

Hello everyone.
I am using IM in a php driven web app to manage uploaded images. Currently, i am accepting all image types, and converting those images to png's for browser compatibility. I've run into a problem dealing with PDF's though. Here's the breakdown.

Conversions from any file type to PDF work using php, and directly from the shell.
Conversion from PDF to any file type work using the shell only.
Conversion from PDF to any file type using PHP fail with a return value of 1.
All other conversions not involving PDF's work both in the shell, and PHP.

I can't seem to figure out why PDF's cant be converted from PHP. Both IM and Ghostscript have been recompiled. Any suggestions/ideas on what may be happening and how i can fix it?

Testing has been done with a 180kb single page pdf file on a Red Hat server.
funkmyer

Re: Php and converting PDF's with IM

Post by funkmyer »

Hi All,

I'm having the identical problem. My setup is as follows:

MAMP (os x leopard)
ImageMagick 6.4.9-6
Ghostscript 8.64

I have been searching on this for a week now and it appears nobody on earth (according to google anyways) has had this problem and been able to fix it.

Bummer...
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Php and converting PDF's with IM

Post by magick »

The PHP environment is different from the command line. For example, the gs program may not be in the execution path. To fix, edit delegate.xml and change references to 'gs' to their absolute path (e.g. /usr/local/bin/gs).
Post Reply