PHP code example of sgh / pdfbox

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

    

sgh / pdfbox example snippets


use SGH\PdfBox\PdfBox;

//$pdf = GENERATED_PDF;
$converter = new PdfBox;
$converter->setPathToPdfBox('/usr/bin/pdfbox-app-1.7.0.jar');
$text = $converter->textFromPdfStream($pdf);
$html = $converter->htmlFromPdfStream($pdf);
$dom  = $converter->domFromPdfStream($pdf);

$converter->getOptions()
    ->setStartPage(2)
	->setEndPage(5);

$converter->getOptions()
    ->setForce(true);

$converter->getOptions()
    ->setSort(true);