PDF Parser

Parser using https://www.pdfparser.org/

Installation

composer require smalot/pdfparser

Extracting Text

    <?php
     //https://pdfparser.org/documentation
    // Include Composer autoloader if not already done.
    include 'vendor/autoload.php';

    // Parse pdf file and build necessary objects.
    $parser = new \Smalot\PdfParser\Parser();
    $pdf    = $parser->parseFile('document.pdf');

    // Retrieve all pages from the pdf file.
    $pages  = $pdf->getPages();

    // Loop over each page to extract text.
    foreach ($pages as $page) {
        echo $page->getText();
    }

    ?>