我需要PDF文件使用php转换为图像。所以我尝试安装imagick并尝试将pdf转换为图像,但它显示在下面的错误
代码:
$pagenumber=1;
$myurl = $_SERVER['DOCUMENT_ROOT'].'/test/filename.pdf['.$pagenumber.']';
$image = new Imagick($myurl);
$image->setResolution( 300, 300 );
$image->setImageFormat("png");
$image->writeImage('newfilename.png');
echo $image;
错误:
Fatal error: Uncaught exception 'ImagickException' with message 'Postscript delegate failed `C:/xampp/htdocs/test/filename.pdf': No such file or directory @ pdf.c/ReadPDFImage/611' in C:\xampp\htdocs\test\image.php:7 Stack trace: #0 C:\xampp\htdocs\test\image.php(7): Imagick->__construct('C:/xampp/htdocs...') #1 {main} thrown in C:\xampp\htdocs\test\image.php on line 7
答案 0 :(得分:0)
你可以找到一些关于想象力无法处理pdf的有用信息
http://imagemagick.org/discourse-server/viewtopic.php?f=2&t=23879