2017 © Pedro Peláez
 

library pdfbox

PHP5 wrapper for the Apache PdfBox ExtractText utility.

image

sgh/pdfbox

PHP5 wrapper for the Apache PdfBox ExtractText utility.

  • Monday, June 11, 2018
  • by schmengler
  • Repository
  • 4 Watchers
  • 12 Stars
  • 9,409 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 5 Forks
  • 1 Open issues
  • 2 Versions
  • 10 % Grown

The README.md

PdfBox

A PHP interface for the PdfBox ExtractText utility, useful to unit-test contents of generated PDFs., (*1)

Build Status Latest Stable Version Latest Unstable Version Total Downloads License, (*2)

Requirements

  • PHP >=5.3 or HHVM
  • Java Runtime Environment
  • PdfBox JAR file
    • Download: http://pdfbox.apache.org/downloads.html
    • Minimum version: 1.2.0
    • Recommended version: >= 1.8.3
  • PHP needs permissions for shell execution

Install

To install with composer:, (*3)

composer require sgh/pdfbox

Basic Usage

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);

If the source PDF is a file, use xxxFromPdfFile() instead xxxFromPdfStream() with the source path as parameter., (*4)

If you want to save the converted output to a file, specify the destination path as second parameter of the xxxFromPdfxxx() methods., (*5)

Advanced Usage

Convert a range of pages instead of the full document:, (*6)

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

Ignore corrupt objects in the PDF:, (*7)

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

Sort text:, (*8)

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

PHPUnit tests

To run the unit tests, change the environment variable PDFBOX_JAR to the full path of your PdfBox JAR file. See phpunit.xml.dist., (*9)

The Versions

11/06 2018

dev-master

9999999-dev https://github.com/schmengler/PdfBox

PHP5 wrapper for the Apache PdfBox ExtractText utility.

  Sources   Download

BSD

The Requires

  • php >=5.3.0

 

The Development Requires

pdf pdfbox

25/06 2015

v1.0.0

1.0.0.0 https://github.com/schmengler/PdfBox

PHP5 wrapper for the Apache PdfBox ExtractText utility.

  Sources   Download

BSD

The Requires

  • php >=5.3.0

 

The Development Requires

pdf pdfbox