PHPackages                             jbpapp/pdf-to-text - 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. jbpapp/pdf-to-text

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

jbpapp/pdf-to-text
==================

Extract text from a pdf file using pdf-to-text binary.

2.0(7y ago)09381[1 issues](https://github.com/jbpapp/pdf-to-text/issues)[1 PRs](https://github.com/jbpapp/pdf-to-text/pulls)MITPHPPHP ^7.2

Since Mar 1Pushed 7y ago1 watchersCompare

[ Source](https://github.com/jbpapp/pdf-to-text)[ Packagist](https://packagist.org/packages/jbpapp/pdf-to-text)[ Docs](https://github.com/jbpapp/pdf-to-text)[ RSS](/packages/jbpapp-pdf-to-text/feed)WikiDiscussions master Synced today

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

Extract text from a pdf
=======================

[](#extract-text-from-a-pdf)

Read PDF files with PHP 5.6 (based on spatie/pdf-to-text package)

**This package is a PHP 5.6+ fork of [Spatie PDF To Text](https://github.com/spatie/pdf-to-text) package. If you use PHP7, please use the original package.**

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

```
 \JBPapp\PdfToText\Pdf::getText('book.pdf'); //returns the text from the pdf
```

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

[](#requirements)

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

```
which pdftotext

```

If it is installed it 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
```

If you're on RedHat or CentOS use this:

```
yum install poppler-utils
```

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

[](#installation)

You can install the package via composer:

```
$ composer require spatie/pdf-to-text
```

Usage
-----

[](#usage)

Extracting text from a pdf is easy.

```
$text = (new Pdf())
    ->setPdf('book.pdf')
    ->text();
```

Or easier:

```
 \JBPapp\PdfToText\Pdf::getText('book.pdf')
```

By default the package will assume that the `pdftotext` is located at `/usr/bin/pdftotext`. If you're using the a different location pass the path to the binary in constructor

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

or as the second parameter to the `getText`-function:

```
 \JBPapp\PdfToText\Pdf::getText('book.pdf', '/custom/path/to/pdftotext')
```

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

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information 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)

- [Janos Papp](https://github.com/jbpapp)
- [Freek Van der Herten](https://github.com/freekmurze)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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

Every ~545 days

Total

3

Last Release

2686d ago

Major Versions

1.1 → 2.02019-02-24

PHP version history (3 changes)1.0PHP ^5.6

1.1PHP ^5.6|^7.0

2.0PHP ^7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/2149db1766447cd9c1c2c0dbd1d5de06dd74263fa42e81cd7a795a9855faf40d?d=identicon)[jbpapp](/maintainers/jbpapp)

---

Top Contributors

[![jbpapp](https://avatars.githubusercontent.com/u/1249444?v=4)](https://github.com/jbpapp "jbpapp (5 commits)")

---

Tags

pdfpdf-to-text

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jbpapp-pdf-to-text/health.svg)

```
[![Health](https://phpackages.com/badges/jbpapp-pdf-to-text/health.svg)](https://phpackages.com/packages/jbpapp-pdf-to-text)
```

###  Alternatives

[spatie/browsershot

Convert a webpage to an image or pdf using headless Chrome

5.2k36.7M156](/packages/spatie-browsershot)[knplabs/knp-snappy

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

4.5k72.4M62](/packages/knplabs-knp-snappy)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[pontedilana/php-weasyprint

PHP library allowing PDF generation from an url or a html page. Wrapper for Kozea/WeasyPrint.

781.2M17](/packages/pontedilana-php-weasyprint)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[mostafaznv/pdf-optimizer

PDF optimization tool for PHP and Laravel applications

172166.2k](/packages/mostafaznv-pdf-optimizer)

PHPackages © 2026

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