简体   繁体   English

将PDF转换为JPG时出现Ghostscript错误

[英]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. 将此插件用于wordpress, 该插件会自动创建在媒体库中上传的pdf缩略图。 I tried to do it but I got an HTTP Error in wordpress. 我尝试这样做,但是在wordpress中遇到了HTTP错误。 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. 老实说,我不知道这意味着什么,但我知道它来自Ghostscript。 The plugin uses ImageMagick to use ghostscript library for pdf manipulation. 该插件使用ImageMagick将ghostscript库用于pdf操作。 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. 有一个命令行开关,格式为“ -d ... =”,=之后的标记无效。

I'd start by taking the Ghostscript parameters and running that with Ghostscript from the command line. 我将从获取Ghostscript参数开始,然后从命令行使用Ghostscript运行该参数。 Just stick gs on the front of what ImageMagick gave you. 只需将gs贴在ImageMagick给您的内容的正面即可。

Assuming that fails in the same way then you can start removing anything from the command line which begins '-d....='. 假设失败的方式相同,那么您可以从以'-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. 如果命令行没有引发相同的错误,那么您将需要找到某种方法来从Ghostscript获取整个反向渠道,我不知道如何从ImageMagick进行此操作,也许有IM经验的人可以进一步评论。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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