Page 1 of 1

Imagick & PDF - The Delegate From Hades

Posted: 2008-08-26T12:54:23-07:00
by jeffmlevy
Good afternoon.

I've been using Imagick with various rasterized formats to great effect for some time. Only recently have I been tasked with doing some PDF related tasks, and I have run into some ... trouble. After spending the greater part of the day browsing posts on this forum, and others, I realize that I am not the first (nor the last) person to experience these issues.

In short, I have gs installed. Apache can find it in the expected location, /usr/bin.

The problem I'm currently experiencing is thus: Reading in a PDF string from a postgres LOB results in abject failure. I receive:

" Postcript delegate failed `': No such file or directory" -- The 'tick' is not of my creation, it's what's being spat out by PHP.

I am using Ubuntu 8.something.or.other, latest updates, Factory fresh, I have not recompiled a thing.

Details:

Code: Select all

$i = new Imagick();

try {
    $i->readImageBlob($lob);
} catch (Exception $e) {
    printf("Something terrible has happened: %s", $e->getMessage());
}
results: The error, mentioned above.

~~~

What's odd is that I am able to run this script from the CLI, as both my user, and as www-data (via su -c).

I do receive some interesting gobbeldygook at the CLI, however, so the execution is not without errant happenings, thus:

Code: Select all

 **** Warning: CS/cs (setcolorspace) operand not a name: [/ICCBased {36 0 resolveR}] ****
   **** Warning: CS/cs (setcolorspace) operand not a name: [/ICCBased -dict-] ****
   **** Warning: CS/cs (setcolorspace) operand not a name: [/ICCBased -dict-] ****
   **** Warning: CS/cs (setcolorspace) operand not a name: [/ICCBased -dict-] ****
   **** Warning: CS/cs (setcolorspace) operand not a name: [/ICCBased -dict-] ****
   **** Warning: CS/cs (setcolorspace) operand not a name: [/ICCBased -dict-] ****
   **** Warning: CS/cs (setcolorspace) operand not a name: [/ICCBased -dict-] ****
   **** Warning: CS/cs (setcolorspace) operand not a name: [/ICCBased -dict-] ****
   **** Warning: CS/cs (setcolorspace) operand not a name: [/ICCBased -dict-] ****
   **** Warning: CS/cs (setcolorspace) operand not a name: [/ICCBased -dict-] ****
   **** Warning: CS/cs (setcolorspace) operand not a name: [/ICCBased -dict-] ****
   **** This file had errors that were repaired or ignored.
   **** The file was produced by: 
   **** >>>> Adobe PDF Library 8.0 <<<<
   **** Please notify the author of the software that produced this
   **** file that it does not conform to Adobe's published PDF
   **** specification.
Moreover, I check apache's error log, and I see this:

Code: Select all

    GPL Ghostscript 8.61: Unrecoverable error, exit code 1
~~~~

If anyone can offer some guidance on troubleshooting & solving this most painful of situations, I would be most appreciative.

Thanks.

Re: Imagick & PDF - The Delegate From Hades

Posted: 2008-08-26T13:06:21-07:00
by jeffmlevy
An interesting development, I think...

I've written out the lob to /tmp/output.pdf, and read it in using $image->readImage('/tmp/output.pdf') ... NO ERRORS.

AHA! says I, must be an issue with Imagick::ReadImageBlob() ??

Re: Imagick & PDF - The Delegate From Hades

Posted: 2008-08-28T01:12:04-07:00
by mkoppanen
Hello,

the last time I tested reading PDF from blob (around ImageMagick 6.3.something) it failed. All thou it says this in wand/ChangeLog:

2008-02-23 6.3.9-0 Cristy <quetzlzacatenango@image...>
* Patch MagickReadImageBlob() to support Postscript which does not have
native blob support.

I don't know if this includes PDFs.