Page zero issue
Posted: 2016-07-26T07:34:08-07:00
For programmers, the first item of a collection is usually the zero. But in my tests, when trying to create a thumb from a PDF document using Ghostscript, the first page got to be 1.
(this example is from a question in stackoverflow)
The error is the same as happened to me we see around the web:
The problem is not really about a name (-dname), is because no temporary file is generated to Imagick to load (though).
In my tests, this was happening with this version
But previous versions (don't know exacly which one) was not generating this error, so wrong codes (as my own) just stop working mysteriously. I found more guys like me, yeah, I was not the only one. I tuck some time to find that the error is not auto corrected anymore (why? You tell me).
I just think people of this cummunity should know about.
Code: Select all
$img = new Imagick($pdf.'[0]'); // WRONG :(
$img = new Imagick($pdf.'[1]'); // OK :D
The error is the same as happened to me we see around the web:
Code: Select all
Fatal error: Uncaught exception 'ImagickException' with message
'PDFDelegateFailed `[ghostscript library]
-q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT
-dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2
"-sDEVICE=pam" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72"
-dUseCIEColor -dFirstPage=1 -dLastPage=1
"-sOutputFile=/tmp/magick-1514TynhowIwvsS8%d"
"-f/tmp/magick-1514ToUFRp0QWKlG"
"-f/tmp/magick-1514zEMWRNGv55Od"':
-dname= must be followed by a valid token
@ error/pdf.c/InvokePDFDelegate/263'
in /home/domain/public_html/pdfPreview.php:46
Stack trace: #0 /home/domain/public_html/pdfPreview.php(46):
Imagick->__construct('./assets/whatsn...')
#1 {main} thrown in
/home/domain/public_html/pdfPreview.php on line 46
In my tests, this was happening with this version
Code: Select all
versionNumber: 1680
versionString: ImageMagick 6.9.0-0 Q16 x86_64 2016-05-05
I just think people of this cummunity should know about.