PHP code example of pifeifei / pdf2image

1. Go to this page and download the library: Download pifeifei/pdf2image library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

pifeifei / pdf2image example snippets


$pdf = new \Pff\Pdf2Image\Pdf(__DIR__ . '/test.pdf');
$pdf->setResolution(192);
$pdf->setCallback(function (Imagick $imagick) {
    $imagick->cropImage(757,1134, 0, 0);
});
$pdf->saveImage(__DIR__ . '/test.jpg');
//$pdf->saveAllPagesAsImages(__DIR__, 'test-');