我需要使用 php 将 PDF 文件转换为图像。所以我尝试安装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