PHPackages                             adamroyle/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. adamroyle/php-xpdf

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

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

XPDF PHP, an Object Oriented library to manipulate XPDF

1.0.1(1y ago)0260↓50%1[1 PRs](https://github.com/adamroyle/PHP-XPDF/pulls)MITPHPPHP &gt;=7.0.0

Since May 31Pushed 1y ago2 watchersCompare

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

READMEChangelog (1)Dependencies (2)Versions (12)Used By (0)

PHP-XPDF
========

[](#php-xpdf)

PHP-XPDF is an object oriented wrapper for XPDF.

Currently available:

- PdfToText
- PdfImages
- PdfInfo
- PdfToPpm

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

[](#installation)

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

```
{
  "require": {
    "adamroyle/php-xpdf": "^1.0.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.

```
$pdfToText = XPDF\PdfToText::create();
$text = $pdfToText->getText('document.pdf');
```

You can optionally extract from a page to another page.

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

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

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

### Extract embedded images

[](#extract-embedded-images)

To extract embedded images from PDF, use the `PdfImages::getImages` method.

```
$pdfImage = XPDF\PdfImage::create();
$pdfImage->setOutputFormat('jpeg');
$images = $pdfImage->getImages('document.pdf');
```

This will return an array of filenames in a temp directory.

### Generate images

[](#generate-images)

To convert the entire page to an images, use the `PdfToPpm::getImages` method.

```
$pdfToPpm = XPDF\PdfToPpm::create();
$pdfToPpm->setOutputFormat('png');

// optional, set an output resolution
$pdfToPpm->setResolution(300); // default is 150

// alternatively, set the max width/height in pixels. this overrides the resolution setting.
// $pdfToPpm->setMaxDimension(2000);

$images = $pdfToPpm->getImages('document.pdf');
```

This will return an array of filenames in a temp directory.

License
-------

[](#license)

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

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 72.9% 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 ~567 days

Recently: every ~812 days

Total

9

Last Release

564d ago

Major Versions

0.4.0 → 1.0.02024-11-01

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

0.1.1PHP &gt;=5.3.3

1.0.0PHP &gt;=7.0.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/30913?v=4)[Adam Royle](/maintainers/ifunk)[@ifunk](https://github.com/ifunk)

---

Top Contributors

[![romainneutron](https://avatars.githubusercontent.com/u/137574?v=4)](https://github.com/romainneutron "romainneutron (70 commits)")[![adamroyle](https://avatars.githubusercontent.com/u/25002779?v=4)](https://github.com/adamroyle "adamroyle (19 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 (2 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/adamroyle-php-xpdf/health.svg)

```
[![Health](https://phpackages.com/badges/adamroyle-php-xpdf/health.svg)](https://phpackages.com/packages/adamroyle-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)
