PHP code example of break-down / pdf-to-image

1. Go to this page and download the library: Download break-down/pdf-to-image 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/ */

    

break-down / pdf-to-image example snippets


$pdf = new BreakDown\PdfToImage\PdfToImage(new BreakDown\PdfToImage\Resources\FilePath($pathToPdfFile));
$pdf->savePageAsImage($pageNumber, $pathToWhereImageShouldBeStored);

$pdf->getNumberOfPages(); //returns an int

$pdf->setOutputFormat('png')
    ->savePageAsImage($pageNumber, $pathToWhereImageShouldBeStored); //the output wil be a png, no matter what

$pdf->setCompressionQuality(100); // sets the compression quality to maximum