php pdf file to image

WBOY
Release: 2016-08-04 09:22:05
Original
1714 people have browsed it

Why the file cannot be read? The permissions of the path pdf file have been set

<code>$PDF = './22.pdf';

$IM =new imagick();
   $IM->setResolution(120,120);
   $IM->setCompressionQuality(100);
   $IM->readImage($PDF);
   foreach($IM as $Key => $Var){
       $Var->setImageFormat('png');
       $Filename = './'.md5($Key.time()).'.png';
       if($Var->writeImage($Filename)==true){
           $Return[]= $Filename;
       }
   }
</code>
Copy after login
Copy after login

Error content: Fatal error: Uncaught exception 'ImagickException' with message 'Failed to read the file' in

Reply content:

Why the file cannot be read? The permissions of the path pdf file have been set

<code>$PDF = './22.pdf';

$IM =new imagick();
   $IM->setResolution(120,120);
   $IM->setCompressionQuality(100);
   $IM->readImage($PDF);
   foreach($IM as $Key => $Var){
       $Var->setImageFormat('png');
       $Filename = './'.md5($Key.time()).'.png';
       if($Var->writeImage($Filename)==true){
           $Return[]= $Filename;
       }
   }
</code>
Copy after login
Copy after login

Error content: Fatal error: Uncaught exception 'ImagickException' with message 'Failed to read the file' in

$PDF uses absolute path

<code>try {
    // read img
}  catch (ImagickException $e) {
    echo  exception;
}</code>
Copy after login
Related labels:
php
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!