Home > Backend Development > PHP Tutorial > php imagick库处理pdf有关问题

php imagick库处理pdf有关问题

WBOY
Release: 2016-06-13 11:34:54
Original
900 people have browsed it

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){   <br />	if(!extension_loaded('imagick')){<br />		echo "imagick";<br />		return false;   <br />	}   <br />	if(!file_exists($PDF)){<br />		echo "noexists";<br />		return false;   <br />	}<br />	$IM = new imagick();   <br />	$IM->setResolution(1000,2000);   <br />	$IM->setCompressionQuality(100);   <br />	$IM->readImage($PDF."[".$page."]");<br />	foreach ($IM as $Key => $Var){<br />		$Var->setImageFormat('png');       <br />		$Filename = $toPath.time().'_'.$Key.'.png';       <br />		if($Var->writeImage($Filename) == true){           <br />			$Return[] = $Filename;       <br />		}<br />	}<br />	return $Return;<br />}
Copy after login

PHP
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template