简体   繁体   中英

Ghostscript error when converting PDF to JPG

I'm using this plugin for wordpress that automatically creates thumbnails of pdfs that are uploaded in the media gallery. I tried to do it but I got an HTTP Error in wordpress. I went in to see the logs and this is the corresponding entry

PHP Fatal error: Uncaught exception 'ImagickException' with message 'PDFDelegateFailed[ghostscript library] -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" "-sOutputFile=/tmp/magick-197485LZ1rl0r3oddl%d" "-f/tmp/magick-197485mLvAYCViAmnC" "-f/tmp/magick-197485qEA_IWTG2MqU"': -dname= must be followed by a valid token
@ error/pdf.c/InvokePDFDelegate/263' in /home/MYSITENAME/public_html/wp-content/plugins/pdf-thumbnails/PdfThumbnailsPlugin.php:59
Stack trace:
#0 /home/MYSITENAME/public_html/wp-content/plugins/pdf-thumbnails/PdfThumbnailsPlugin.php(59): Imagick->__construct('/home/MYSITENAME/...')
#1 /home/MYSITENAME/public_html/wp-content/plugins/pdf-thumbnails/PdfThumbnailsPlugin.php(42): PdfThumbnailsPlugin->getThumbnailBlob('/home/MYSITENAME/...')
#2 /home/MYSITENAME/public_html/wp-content/plugins/pdf-thumbnails/PdfThumbnailsPlugin.php(35): PdfThumbnailsPlugin->generateThumbnail(3202)
#3 /home/MYSITENAME/public_ht in /home/tooltime/public_html/wp-content/plugins/pdf-thumbnails/PdfThumbnailsPlugin.php on line 59`

To be honest, I have no idea what it means but I know it's from Ghostscript. The plugin uses ImageMagick to use ghostscript library for pdf manipulation. Here are some configurationn details of my server

Server: Linux
PHP: v5.6
ImageMagick: v6.9
Wordpress: v4.5.3

Any help would be appreciated in deciphering this message.

Well basically it means what it says. There was a command line switch of the form '-d...=' and the token after = wasn't valid.

I'd start by taking the Ghostscript parameters and running that with Ghostscript from the command line. Just stick gs on the front of what ImageMagick gave you.

Assuming that fails in the same way then you can start removing anything from the command line which begins '-d....='. Remove them one at a time, when you find the one which causes the problem then you have something to work with.

If the command line doesn't provoke the same error, then you will need to find some way to get the whole backchannel from Ghostscript, I have no idea how to do that from ImageMagick, perhaps someone with IM experience can comment further.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM