PHP code example of quangvule / pdf-to-text

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

    

quangvule / pdf-to-text example snippets


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

apt-get install poppler-utils

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

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

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

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

which pdftotext