PHPackages                             php-xpdf/php-xpdf - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PDF &amp; Document Generation](/categories/documents)
4. /
5. php-xpdf/php-xpdf

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

php-xpdf/php-xpdf
=================

XPDF PHP, an Object Oriented library to manipulate XPDF

4.1.0(8y ago)38224.4k↓37.5%26[4 PRs](https://github.com/alchemy-fr/PHP-XPDF/pulls)2MITPHPPHP ~7.0

Since May 31Pushed 6y ago11 watchersCompare

[ Source](https://github.com/alchemy-fr/PHP-XPDF)[ Packagist](https://packagist.org/packages/php-xpdf/php-xpdf)[ RSS](/packages/php-xpdf-php-xpdf/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (4)Versions (9)Used By (2)

PHP-XPDF
========

[](#php-xpdf)

[![Build Status](https://camo.githubusercontent.com/0c640addecf731d8d4237f46988115c4724c559a570e9eeee1d987e8357df65b/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f616c6368656d792d66722f5048502d585044462e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/alchemy-fr/PHP-XPDF)

PHP-XPDF is an object oriented wrapper for XPDF. For the moment, only PdfTotext wrapper is available.

Installation
------------

[](#installation)

It is recommended to install PHP-XPDF through [Composer](http://getcomposer.org) :

```
{
    "require": {
        "php-xpdf/php-xpdf": "~0.2.0"
    }
}
```

Dependencies :
--------------

[](#dependencies-)

In order to use PHP-XPDF, you need to install XPDF. Depending of your configuration, please follow the instructions at on the [XPDF website](http://www.foolabs.com/xpdf/download.html).

Documentation
-------------

[](#documentation)

### Driver Initialization

[](#driver-initialization)

The easiest way to instantiate the driver is to call the `create method.

```
$pdfToText = XPDF\PdfToText::create();
```

You can optionaly pass a configuration and a logger (any `Psr\Logger\LoggerInterface`).

```
$pdfToText = XPDF\PdfToText::create(array(
    'pdftotext.binaries' => '/opt/local/xpdf/bin/pdftotext',
    'pdftotext.timeout' => 30, // timeout for the underlying process
), $logger);
```

### Extract text

[](#extract-text)

To extract text from PDF, use the `getText` method.

```
$text = $pdtTotext->getText('document.pdf');
```

You can optionally extract from a page to another page.

```
$text = $pdtTotext->getText('document.pdf', $from = 1, $to = 4);
```

You can also predefined how much pages would be extracted on any call.

```
$pdtTotext->setpageQuantity(2);
$pdtTotext->getText('document.pdf'); // extracts page 1 and 2
```

### Use with Silex

[](#use-with-silex)

A [Silex](http://silex.sensiolabs.org) service provider is available

```
$app = new Silex\Application();
$app->register(new XPDF\XPDFServiceProvider());

$app['xpdf.pdftotext']->getText('document.pdf');
```

Options can be passed to customize the provider.

```
$app->register(new XPDF\XPDFServiceProvider(), array(
    'xpdf.configuration' => array(
        'pdftotext.timeout'  => 30,
        'pdftotext.binaries' => '/opt/local/xpdf/bin/pdftotext',
    ),
    'xpdf.logger' => $logger,
));
```

License
-------

[](#license)

This project is licensed under the [MIT license](http://opensource.org/licenses/MIT).

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity45

Moderate usage in the ecosystem

Community25

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 92.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~357 days

Recently: every ~436 days

Total

7

Last Release

2958d ago

Major Versions

0.2.3 → 4.1.02018-04-12

PHP version history (3 changes)0.1.0PHP &gt;=5.3.2

0.1.1PHP &gt;=5.3.3

4.1.0PHP ~7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/3c264f69af4c60cb9cc98a522b4663f4b6a2708629cabc14409478ab6fc35348?d=identicon)[romain](/maintainers/romain)

---

Top Contributors

[![romainneutron](https://avatars.githubusercontent.com/u/137574?v=4)](https://github.com/romainneutron "romainneutron (70 commits)")[![aikchun](https://avatars.githubusercontent.com/u/4145525?v=4)](https://github.com/aikchun "aikchun (3 commits)")[![aztech-dev](https://avatars.githubusercontent.com/u/93562568?v=4)](https://github.com/aztech-dev "aztech-dev (1 commits)")[![gohanman](https://avatars.githubusercontent.com/u/426966?v=4)](https://github.com/gohanman "gohanman (1 commits)")[![nlegoff](https://avatars.githubusercontent.com/u/511494?v=4)](https://github.com/nlegoff "nlegoff (1 commits)")

---

Tags

pdfxpdf

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/php-xpdf-php-xpdf/health.svg)

```
[![Health](https://phpackages.com/badges/php-xpdf-php-xpdf/health.svg)](https://phpackages.com/packages/php-xpdf-php-xpdf)
```

###  Alternatives

[barryvdh/laravel-dompdf

A DOMPDF Wrapper for Laravel

7.3k87.6M278](/packages/barryvdh-laravel-dompdf)[tecnickcom/tcpdf

TCPDF is a PHP class for generating PDF documents and barcodes.

4.5k101.8M473](/packages/tecnickcom-tcpdf)[mpdf/mpdf

PHP library generating PDF files from UTF-8 encoded HTML

4.7k77.1M493](/packages/mpdf-mpdf)[knplabs/knp-snappy

PHP library allowing thumbnail, snapshot or PDF generation from a url or a html page. Wrapper for wkhtmltopdf/wkhtmltoimage.

4.5k68.3M56](/packages/knplabs-knp-snappy)[spatie/browsershot

Convert a webpage to an image or pdf using headless Chrome

5.2k32.1M102](/packages/spatie-browsershot)[smalot/pdfparser

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

2.7k34.5M216](/packages/smalot-pdfparser)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
