PHP code example of yetidevworks / yetipdf

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

    

yetidevworks / yetipdf example snippets


use YetiPdf\YetiPdf;

$doc = YetiPdf::open('manual.pdf');

foreach ($doc->pages() as $number => $text) {
    // index $text as page $number
}

$doc->text();          // the whole document as one string
$doc->page(12);        // just one page
$doc->pageCount();
$doc->info();          // ['Title' => ..., 'Author' => ..., ...]
$doc->isEncrypted();
$doc->warnings();      // anything it had to work around, in plain English

YetiPdf::parse($bytes);   // if you already have the PDF in a string

use YetiPdf\Options;

$doc = YetiPdf::open('report.pdf', new Options(
    password: 'secret',        // for PDFs that need one to open
    dehyphenate: true,         // "exam-" + "ple" across a line break becomes "example"
    expandLigatures: true,     // "fi" becomes "fi"
    annotations: true,         // 
bash
benchmarks/fetch-corpus.sh                         # about 300MB, downloaded once
composer install -d benchmarks                     # the other libraries, for comparison
benchmarks/bench.sh yetipdf prinsfrank smalot
php benchmarks/diff.php some.pdf                   # which words differ from pdftotext