簡體   English   中英

ghostscript 9.26 更新打破了多頁 PDF 的 imagick readImage

[英]ghostscript 9.26 update breaks imagick readImage for multipage PDF

自從昨天早上 ghostscript 更新 9.25 -> 9.26(在 debian 上)以來,我們收到此錯誤:

ErrorMessage: FailedToExecuteCommand 
`'gs' -sstdout=%stderr -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT
 -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 
'-sDEVICE=pngalpha' -dTextAlphaBits=4 -dGraphicsAlphaBits=4 '-r300x300' 
-dFirstPage=1 -dLastPage=1 '-sOutputFile=/tmp/magick-39903EapVvuyNQxL4%d' 
'-f/tmp/magick-39903VD0GMIpLPaIN' 
'-f/tmp/magick-399031owlSOb4aOEw'' (-1) 
@ error/delegate.c/ExternalDelegateCommand/462

嘗試閱讀多頁 PDF 的第一頁時:

$this->resource = new \Imagick();
$this->resource->setResolution(300, 300);
$this->resource->readImage($path . '[0]');

知道如何解決這個問題嗎?

請參閱: https : //www.ghostscript.com/doc/9.26/History9.htm#Version9.26請參閱: https : //secure.php.net/manual/en/imagick.readimage.php

幾乎可以肯定這個錯誤報告:

https://bugs.ghostscript.com/show_bug.cgi?id=699815

您的解決方案是; 不要使用 pngalpha 設備,不要使用 FirstPage/LastPage,升級到帶有修復的版本,或降級到早期版本。 盡管該錯誤可能存在於許多早期版本中,但我不知道為什么以前沒有出現過。

我沒有“解決方案”,但可以確認升級到 gs 9.26 后的問題。 我發現,正如 KenS 指出的那樣,刪除 gs 中的參數 -dFirstPage=1 -dLastPage=1 時一切正常。

同樣有效的是刪除 gs 參數 -dMaxBitmap=500000000。 在 PHP 中的含義,刪除 [PAGE] 即:

$im = new \Imagick();
$im->readImage('/tmp/test.pdf');

我的工作解決方案是降級到 ghostscript 9.22。 我正在使用 Ubuntu 仿生 LTS。 因此我不得不運行:

sudo apt-get remove ghostscript
sudo apt-get autoremove
sudo apt-get install ghostscript=9.22~dfsg+1-0ubuntu1 libgs9=9.22~dfsg+1-0ubuntu1 libgs9-common=9.22~dfsg+1-0ubuntu1
sudo apt-mark auto libgs9
sudo apt-mark auto libgs9-common

我在使用ghostscript版本9.26的Ubuntu中遇到了相同的錯誤。 ghostscript-x with apt-get update && apt-get install -y ghostscript-x額外安裝了ghostscript-x with apt-get update && apt-get install -y ghostscript-x之后,問題得以解決。

(Ghostscript 9.26) 有同樣的問題,在增加 setResolution(600, 600) 后又開始工作了。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM