1. Go to this page and download the library: Download lukasss93/pdf-to-ppm 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/ */
lukasss93 / pdf-to-ppm example snippets
use Lukasss93\PdfToPpm\PdfToPpm;
$pdf = PdfToPpm::create()->setPdf($pathToPdf);
$pdf->saveImage($pathToWhereImageShouldBeStored); // it will save the first page
use Lukasss93\PdfToPpm\PdfToPpm;
$pdf = PdfToPpm::create()->setPdf($pathToPdf);
$pdf->saveAllPagesAsImages($pathToWhereImageShouldBeStored);
$pdf->getNumberOfPages(); //returns an int
$pdf->setPage(2)
->saveImage($pathToWhereImageShouldBeStored); // it saves the second page
$pdf->setOutputFormat('png')
->saveImage($pathToWhereImageShouldBeStored); // the output wil be a png, no matter what
$pdf->setResolution(200); // sets the resolution
$pdf->setGray(true); // sets the grayscale
bash
which pdftoppm
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.