PHP code example of forest / pdf-to-text

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

    

forest / pdf-to-text example snippets


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

apt-get install poppler-utils

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

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

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

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

which pdftotext