Postscript Delegate Failed, many fixes tried

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Post Reply
mcescalante
Posts: 3
Joined: 2012-10-07T16:41:20-07:00
Authentication code: 67789

Postscript Delegate Failed, many fixes tried

Post by mcescalante »

I am looking to get ImageMagick working with gs and imagick. I am trying to execute the line of code:

Code: Select all

$img = new Imagick($pdf_file."[0]");
When I do, I get this error:

Code: Select all

exception 'ImagickException' with message 'Postscript delegate failed...
I have done quite a bit of Googling / attempts to fix this. I have (in no order)
- Reinstalled gs and ImageMagick (currently imagick is giving me a bizarre make error due to the fact that I am using the RC rather than the stable)
- Added the extension to php.ini (imagick.so)
- Re-configured the ImageMagick installation to include --with-gslib (gs is added to the list)
- Dynamically linked /usr/bin's
- A few other things (yes, they are all available and installed).

The convert command DOES work, I have tested and confirmed it's usage with the following line which runs fine with no errors. The resulting PDF displays perfectly.

Code: Select all

convert test.pdf test2.pdf
I've exhausted nearly everything I can think of, and most of what Google and other sites have to offer. Does anyone have any advice on the best way to approach this? I'm glad to produce logs and such, just not sure exactly what would help with this error.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Postscript Delegate Failed, many fixes tried

Post by fmw42 »

Below is the correct syntax to get the first page, not what you had at first. There should be no . between $pdf_file and [0] as the $pdf_file should be including the period with suffix, i.e., .pdf

$img = new Imagick("$pdf_file[0]");
Last edited by fmw42 on 2012-10-08T17:31:32-07:00, edited 3 times in total.
mcescalante
Posts: 3
Joined: 2012-10-07T16:41:20-07:00
Authentication code: 67789

Re: Postscript Delegate Failed, many fixes tried

Post by mcescalante »

fmw42 wrote:I am not an expert on Imagick, but try

$img = new Imagick("$pdf_file[0]");
Thanks for the advice, but the code isn't the issue. pdf_file is not an array, so your edit won't change anything.

Any other thoughts? Would love to get this resolved :(
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Postscript Delegate Failed, many fixes tried

Post by fmw42 »

mcescalante wrote:
fmw42 wrote:I am not an expert on Imagick, but try

$img = new Imagick("$pdf_file[0]");
Thanks for the advice, but the code isn't the issue. pdf_file is not an array, so your edit won't change anything.

Any other thoughts? Would love to get this resolved :(
If your pdf file is not a multilayer, multipage file and you are not trying to extract the first [0] layer/page, then what is [0] doing following a period in your command.
mcescalante
Posts: 3
Joined: 2012-10-07T16:41:20-07:00
Authentication code: 67789

Re: Postscript Delegate Failed, many fixes tried

Post by mcescalante »

fmw42 wrote:If your pdf file is not a multilayer, multipage file and you are not trying to extract the first [0] layer/page, then what is [0] doing following a period in your command.
The pdf is a multilayer multipage pdf that we are extracting the first page of. It displays the first page of the pdf on the webpage. When the code is changed, it throws exactly the same.

This is likely not a code issue, this is almost positively an issue stemming from the fact that imagick is compiled & installed from sources rather than from a package updater. The server config we're using does not allow imagick to be installed correctly with a package updater.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Postscript Delegate Failed, many fixes tried

Post by fmw42 »

Below is the correct syntax to get the first page, not what you had at first. There should be no . between $pdf_file and [0] as the $pdf_file should be including the period with suffix, i.e., .pdf

$img = new Imagick("$pdf_file[0]");
Post Reply