简体   繁体   中英

PDF Pages to Images Using Imagick Skips Last PDF Page

I am using Imagick to generate JPG images from a pre-generated PDF file which contains several pages, Eg file contains a total of 6 pages as PDF File. After running through the code below as:

        $imagick = new \Imagick();
        $imagick->setResolution(500, 500);
        $imagick->readImage($pdfFinalFile);
        $imagick->writeImages($jpgPath.'/Image.jpg',false);

Output comes total of 5 JPG images from 0 to 4 numbered sequences.

Unable to determine why writeImages function is skipping the Last Page of PDF which I have determined by checking the details on the Image that the Last Page is skipped

  • Version: ImageMagick-6
  • PHP Version: 7.1
  • OS: Ubuntu 18

Expecting all the Pages of the PDF should be converted to Images

try this code I not near to computer



$im = new Imagick();

$im->setResolution(3000,3000);
$im->readimage('file.pdf'); 
$im->setImageFormat('jpeg');    
$im->writeImage('outb.jpg'); 
$im->clear(); 
$im->destroy();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM