PHP code example of escarter / poppler-wrapper-php
1. Go to this page and download the library: Download escarter/poppler-wrapper-php 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/ */
escarter / poppler-wrapper-php example snippets
use Escarter\PopplerPhp\PdfToText;
use Escarter\PopplerPhp\getOutput;
echo PdfToText::getText('document.pdf','/opt/homebrew/bin/pdftotext'); //returns the text from the pdf
echo PdfSeparate::getOutput('document.pdf','/opt/homebrew/bin/pdfseparate','destination_path/page_%d.pdf'); //returns null
$text = (new PdfToText())
->setPdf('document.pdf')
->text();
echo PdfToText::getText('document.pdf');
$text = (new PdfToText('/custom/path/to/pdftotext'))
->setPdf('document.pdf')
->text();