PHPackages                             escarter/poppler-wrapper-php - 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. escarter/poppler-wrapper-php

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

escarter/poppler-wrapper-php
============================

This is a php wrapper for Poppler Utility tools

v1.1.0(6mo ago)55.5k↓35.7%1MITPHPPHP ^8.1CI failing

Since Jun 7Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/Escarter/poppler-wrapper-php)[ Packagist](https://packagist.org/packages/escarter/poppler-wrapper-php)[ Docs](https://github.com/escarter/poppler-wrapper-php)[ GitHub Sponsors](https://github.com/escarter)[ RSS](/packages/escarter-poppler-wrapper-php/feed)WikiDiscussions main Synced yesterday

READMEChangelog (2)Dependencies (5)Versions (4)Used By (0)

Extract text from pdf or separat a single pdf files to multiple files
=====================================================================

[](#extract-text-from-pdf-or-separat-a-single-pdf-files-to-multiple-files)

This package provides a class to extract text from a pdf.

```
use Escarter\PopplerPhp\PdfToText;
use Escarter\PopplerPhp\getOutput;

echo PdfToText::getText('document.pdf','/opt/homebrew/bin/pdftotext'); //returns the text from the pdf
echo PdfSeparate::getOutput('document.pdf','/opt/homebrew/bin/pdfseparate','destination_path/page_%d.pdf'); //returns null
```

Requirements
------------

[](#requirements)

Behind the scenes this package leverages [pdftotext](https://en.wikipedia.org/wiki/Pdftotext) and [pdfseparate](https://en.wikipedia.org/wiki/Pdfseparate).You can verify if the binary installed on your system by issueing this command:

```
which pdftotext
```

```
which which pdfseparate
```

If they are installed the above commands will return the path to the binary.

To install the binary you can use this command on Ubuntu or Debian:

```
apt-get install poppler-utils
```

On a mac you can install the binary using brew

```
brew install poppler
```

If you're on RedHat or CentOS use this:

```
yum install poppler-utils
```

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

[](#installation)

You can install the package via composer:

```
composer require escarter/poppler-wrapper-php
```

Usage Extracting text
---------------------

[](#usage-extracting-text)

Extracting text from a pdf is easy.

```
$text = (new PdfToText())
    ->setPdf('document.pdf')
    ->text();
```

Or easier:

```
echo PdfToText::getText('document.pdf');
```

By default the package will assume that the `pdftotext` command is located at `/usr/bin/pdftotext`. If it is located elsewhere pass its binary path to constructor

```
$text = (new PdfToText('/custom/path/to/pdftotext'))
    ->setPdf('document.pdf')
    ->text();
```

or as the second parameter to the `getText` static method:

```
echo PdfToText::getText('document.pdf', '/custom/path/to/pdftotext');
```

Sometimes you may want to use [pdftotext options](https://linux.die.net/man/1/pdftotext). To do so you can set them up using the `setOptions` method.

```
$text = (new PdfToText())
    ->setPdf('table.pdf')
    ->setOptions(['layout', 'r 96'])
    ->text()
;
```

or as the third parameter to the `getText` static method:

```
echo PdfToText::getText('document.pdf', null, ['layout', 'opw myP1$$Word']);
```

Please note that successive calls to `setOptions()` will overwrite options passed in during previous calls.

If you need to make multiple calls to add options (for example if you need to pass in default options when creating the `Pdf` object from a container, and then add context-specific options elsewhere), you can use the `addOptions()` method:

```
$text = (new PdfToText())
    ->setPdf('table.pdf')
    ->setOptions(['layout', 'r 96'])
    ->addOptions(['f 1'])
    ->text()
;
```

Usage Separating Pdf into single files for each page
----------------------------------------------------

[](#usage-separating-pdf-into-single-files-for-each-page)

Separating a single pdf file into multiple files for each page.

```
 (new PdfSeparate())
    ->setPdf('document.pdf')
    ->setDestination('destination_path/page_%d.pdf')
    ->split();
```

Or easier:

```
 PdfSeparate::getOutput('document.pdf','destination_path/page_%d.pdf');
```

Once this is executed you can check in the destination\_path to see all the splitted files (page\_1.pdf, page\_2.pdf....)

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information about what has changed recently.

Testing
-------

[](#testing)

```
 composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Escarter Mbutuh](https://github.com/escarter)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance66

Regular maintenance activity

Popularity28

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 81.8% 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 ~825 days

Total

3

Last Release

200d ago

PHP version history (2 changes)1.0.0PHP ^7.3|^8.0

v1.1.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/cceee8c6b0452354edcc2de2bfc370f108588f2320ccbd8ef8881499593d902c?d=identicon)[Escarter](/maintainers/Escarter)

---

Top Contributors

[![Escarter](https://avatars.githubusercontent.com/u/16120861?v=4)](https://github.com/Escarter "Escarter (9 commits)")[![ChenRuihua](https://avatars.githubusercontent.com/u/46486133?v=4)](https://github.com/ChenRuihua "ChenRuihua (2 commits)")

---

Tags

escarterpoppler-wrapper-php

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/escarter-poppler-wrapper-php/health.svg)

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

###  Alternatives

[friendsofphp/php-cs-fixer

A tool to automatically fix PHP code style

13.5k251.2M25.2k](/packages/friendsofphp-php-cs-fixer)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[civicrm/civicrm-core

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

751291.4k43](/packages/civicrm-civicrm-core)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[phpactor/phpactor

PHP refactoring and intellisense tool for text editors

1.9k17.1k1](/packages/phpactor-phpactor)

PHPackages © 2026

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