PHP code example of jbpapp / pdf-to-text

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

    

jbpapp / pdf-to-text example snippets


 \JBPapp\PdfToText\Pdf::getText('book.pdf'); //returns the text from the pdf

apt-get install poppler-utils

$text = (new Pdf())
    ->setPdf('book.pdf')
    ->text();

 \JBPapp\PdfToText\Pdf::getText('book.pdf')

$text = (new Pdf('/custom/path/to/pdftotext'))
    ->setPdf('book.pdf')
    ->text();

 \JBPapp\PdfToText\Pdf::getText('book.pdf', '/custom/path/to/pdftotext')

which pdftotext