Pdf parser library. Can read and extract information from pdf file.

Installs: 11 647 552

Dependents: 130

Suggesters: 5

Security: 0

Stars: 2 000

Watchers: 86

Forks: 509

Open Issues: 196

v2.5.0 2023-04-24 07:00 UTC


Version CI CS Scrutinizer Code Quality Downloads

The smalot/pdfparser is a standalone PHP package that provides various tools to extract data from PDF files.

This library is under active maintenance. There is no active development by the author of this library (at the moment), but we welcome any pull request adding/extending functionality!


  • Load/parse objects and headers
  • Extract metadata (author, description, ...)
  • Extract text from ordered pages
  • Support of compressed PDFs
  • Support of MAC OS Roman charset encoding
  • Handling of hexa and octal encoding in text sections
  • Create custom configurations (see

Currently, secured documents and extracting form data are not supported.


This library is under the LGPLv3 license.


This library requires PHP 7.1+ since v1. You can install it via Composer:

composer require smalot/pdfparser

In case you can't use Composer, you can include alt_autoload.php-dist. It will include all required files automatically.

Quick example


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

$text = $pdf->getText();
echo $text;

Further usage information can be found here.


Documentation can be found in the doc folder.