PHPackages                             restruct/xpdf-static - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. restruct/xpdf-static

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

restruct/xpdf-static
====================

Pre-compiled xpdf tools with PHP wrappers (pdftotext, pdfinfo, pdftopng, pdfimages) for Linux x64 and macOS

1.0.0(2mo ago)047↑33.3%2GPL-2.0-onlyPHPPHP &gt;=8.1

Since Feb 27Pushed 2mo agoCompare

[ Source](https://github.com/restruct/xpdf-static)[ Packagist](https://packagist.org/packages/restruct/xpdf-static)[ RSS](/packages/restruct-xpdf-static/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (2)

Xpdf tools — pre-compiled binaries + PHP wrappers
=================================================

[](#xpdf-tools--pre-compiled-binaries--php-wrappers)

Pre-compiled [Xpdf](https://www.xpdfreader.com/) command-line tools with fluent PHP wrapper classes. Includes `pdftotext`, `pdfinfo`, `pdftopng`, `pdfimages`, and more.

**Xpdf version:** 4.06

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

[](#installation)

```
composer require restruct/xpdf-static
```

Quick examples
--------------

[](#quick-examples)

```
use Restruct\Xpdf\PdfToText;
use Restruct\Xpdf\PdfInfo;
use Restruct\Xpdf\PdfToPng;
use Restruct\Xpdf\PdfImages;

// Extract text (UTF-8, layout preserved)
$text = PdfToText::extract('/path/to/file.pdf');

// Page count
$pages = PdfInfo::pageCount('/path/to/file.pdf');

// Full document info
$info = PdfInfo::create('/path/to/file.pdf');
echo $info->getTitle();
echo $info->getPageCount();
$dims = $info->getPageDimensions();
echo $dims->standard; // 'A4'

// Render pages to PNG
$pngs = PdfToPng::render('/path/to/file.pdf', '/tmp/output', dpi: 240);

// Extract images
$images = PdfImages::extractAll('/path/to/file.pdf', '/tmp/img');

// List images without extracting
$listing = PdfImages::list('/path/to/file.pdf');
```

Wrapper classes
---------------

[](#wrapper-classes)

### `Restruct\Xpdf\Xpdf` — binary resolution + generic runner

[](#restructxpdfxpdf--binary-resolution--generic-runner)

```
use Restruct\Xpdf\Xpdf;

// Check availability
Xpdf::isAvailable();
Xpdf::availableTools(); // ['pdftotext', 'pdfinfo', ...]

// Run any tool directly
$result = Xpdf::run('pdftotext', ['-layout', '-enc', 'UTF-8', 'input.pdf', '-']);
echo $result->output;
echo $result->isSuccessful();
```

### `Restruct\Xpdf\PdfToText` — text extraction

[](#restructxpdfpdftotext--text-extraction)

```
use Restruct\Xpdf\PdfToText;

// Quick extraction
$text = PdfToText::extract('input.pdf');

// Fluent API with full control
$text = PdfToText::create('input.pdf')
    ->encoding('UTF-8')
    ->layout()
    ->pages(1, 5)
    ->noPageBreak()
    ->noDiag()        // skip watermarks
    ->getText();

// Table mode for tabular data
$text = PdfToText::create('input.pdf')
    ->table()
    ->encoding('UTF-8')
    ->getText();

// Save to file
PdfToText::create('input.pdf')
    ->encoding('UTF-8')
    ->toFile('output.txt');
```

### `Restruct\Xpdf\PdfInfo` — document metadata

[](#restructxpdfpdfinfo--document-metadata)

Replaces `howtomakeaturn/pdfinfo` with improved page dimension detection.

```
use Restruct\Xpdf\PdfInfo;

$info = PdfInfo::create('input.pdf');

// Basic metadata
$info->getTitle();
$info->getAuthor();
$info->getPageCount();
$info->getPdfVersion();
$info->getCreationDate();

// Page dimensions with paper size detection
$dims = $info->getPageDimensions();
$dims->width;       // 595 (points)
$dims->height;      // 842 (points)
$dims->standard;    // 'A4'
$dims->orientation; // 'portrait'
$dims->rotation;    // 0
$dims->nearestDIN;  // 'A4' or 'A3'

// All fields as array
$all = $info->getAll();
```

### `Restruct\Xpdf\PdfToPng` — page rendering

[](#restructxpdfpdftopng--page-rendering)

```
use Restruct\Xpdf\PdfToPng;

// Render all pages
$files = PdfToPng::render('input.pdf', '/tmp/page', dpi: 240);
// ['/tmp/page-000001.png', '/tmp/page-000002.png', ...]

// Render single page
$file = PdfToPng::renderPage('input.pdf', 1, '/tmp/thumb', dpi: 72);

// Full control
$files = PdfToPng::create('input.pdf')
    ->resolution(300)
    ->pages(1, 10)
    ->gray()
    ->convert('/tmp/output');
```

### `Restruct\Xpdf\PdfImages` — image extraction

[](#restructxpdfpdfimages--image-extraction)

```
use Restruct\Xpdf\PdfImages;

// Extract all images (JPEG where possible)
$files = PdfImages::extractAll('input.pdf', '/tmp/img');

// Extract unique images only
$files = PdfImages::extractUnique('input.pdf', '/tmp/img');

// List images without extracting
$list = PdfImages::list('input.pdf');
foreach ($list as $img) {
    echo "{$img['page']}: {$img['width']}x{$img['height']} {$img['color']} {$img['enc']}\n";
}

// Full control
$files = PdfImages::create('input.pdf')
    ->pages(1, 5)
    ->jpeg()
    ->unique()
    ->extract('/tmp/img');
```

Binary resolution
-----------------

[](#binary-resolution)

The bootstrap auto-detects the platform and sets `XPDF_BIN_DIR`:

1. `XPDF_BIN_DIR` constant (if already defined)
2. `XPDF_BIN_DIR` environment variable
3. macOS: bundled `x64/mac/` binaries
4. Linux: bundled `x64/linux/` binaries

Available binaries
------------------

[](#available-binaries)

All 9 xpdf tools are bundled: `pdftotext`, `pdfinfo`, `pdffonts`, `pdfimages`, `pdftohtml`, `pdftopng`, `pdftoppm`, `pdftops`, `pdfdetach`.

License
-------

[](#license)

- Xpdf tools: GNU General Public License v2 (Copyright Glyph &amp; Cog, LLC)
- Wrapper code: MIT (Copyright Restruct web &amp; apps)

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance84

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

80d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4d3680d6353e5f171543435b89965ba2588186ad7ec0ec97cbf572704fec2a4f?d=identicon)[micschk](/maintainers/micschk)

---

Top Contributors

[![micschk](https://avatars.githubusercontent.com/u/1005986?v=4)](https://github.com/micschk "micschk (3 commits)")

### Embed Badge

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

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

###  Alternatives

[symplify/monorepo-builder

Not only Composer tools to build a Monorepo.

5205.3M82](/packages/symplify-monorepo-builder)[spatie/typescript-transformer

This is my package typescript-transformer

3706.5M16](/packages/spatie-typescript-transformer)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k20](/packages/civicrm-civicrm-core)[shivas/versioning-bundle

Symfony application versioning, simple console command to manage version (with providers e.g. git tag) of your application using Semantic Versioning 2.0.0 recommendations

1121.2M1](/packages/shivas-versioning-bundle)[eclipxe/cfdiutils

PHP Common utilities for Mexican CFDI 3.2, 3.3 &amp; 4.0

141129.9k6](/packages/eclipxe-cfdiutils)[shyim/danger-php

Port of danger to PHP

8544.9k](/packages/shyim-danger-php)

PHPackages © 2026

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