您好,欢迎访问一九零五行业门户网

php imagick库处理pdf有关问题

php imagick库处理pdf问题
fatal error: uncaught exception 'imagickexception' with message 'unable to open image `papers/1375680721.pdf': no such file or directory @ error/blob.c/openblob/2622' in c:\xampp\htdocs\fc\editpaper.php:38 stack trace: #0 
c:\xampp\htdocs\fc\editpaper.php(38): imagick->readimage('papers/13756807...') #1 c:\xampp\htdocs\fc\editpaper.php(108): pdf2png('papers/13756807...', 'papers/', 0) #2 c:\xampp\htdocs\fc\editpaper.php(211): anli->insert('') #3 {main} thrown in c:\xampp\htdocs\fc\editpaper.php on line 38
报如下错误
function pdf2png($pdf,$topath,$page){
if(!extension_loaded('imagick')){
echo imagick;
return false;
}
if(!file_exists($pdf)){
echo noexists;
return false;
}
$im = new imagick();
$im->setresolution(1000,2000);
$im->setcompressionquality(100);
$im->readimage($pdf.[.$page.]);
foreach ($im as $key => $var){
$var->setimageformat('png');
$filename = $topath.time().'_'.$key.'.png';
if($var->writeimage($filename) == true){
$return[] = $filename;
}
}
return $return;
}
php 分享到:
------解决方案--------------------
windows系统下运行,还需要装一个安装软件ghostscript;下载地址:http://downloads.ghostscript.com/public/gs904w32.exe  ; 祝你成功。
其它类似信息

推荐信息