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

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

forest/pdf-to-text
==================

Extract text from a pdf

2.0.4(6y ago)010.7kMITPHPPHP ^5.5|^5.6|~7.0

Since Dec 31Pushed 6y ago1 watchersCompare

[ Source](https://github.com/forest2087/pdf-to-text)[ Packagist](https://packagist.org/packages/forest/pdf-to-text)[ Docs](https://github.com/forest2087/pdf-to-text)[ RSS](/packages/forest-pdf-to-text/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (2)Versions (12)Used By (0)

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

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

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

```
 \forest\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 forest/pdf-to-text
```

Usage
-----

[](#usage)

Extracting text from a pdf is easy.

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

Or easier:

```
 \forest\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:

```
 \forest\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.

License
-------

[](#license)

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

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 69.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 ~150 days

Recently: every ~171 days

Total

10

Last Release

2528d ago

Major Versions

0.0.1 → 1.0.02015-12-31

1.0.3 → 2.0.02017-10-24

PHP version history (4 changes)0.0.1PHP ^7.0

2.0.0PHP &gt;=5.5

2.0.1PHP ^5.5|^5.6

2.0.4PHP ^5.5|^5.6|~7.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/964803?v=4)[Forest Wang](/maintainers/forest2087)[@forest2087](https://github.com/forest2087)

---

Top Contributors

[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (30 commits)")[![Julusian](https://avatars.githubusercontent.com/u/1327476?v=4)](https://github.com/Julusian "Julusian (5 commits)")[![forest-ep](https://avatars.githubusercontent.com/u/20067842?v=4)](https://github.com/forest-ep "forest-ep (4 commits)")[![sebastiandedeyne](https://avatars.githubusercontent.com/u/1561079?v=4)](https://github.com/sebastiandedeyne "sebastiandedeyne (3 commits)")[![forest2087](https://avatars.githubusercontent.com/u/964803?v=4)](https://github.com/forest2087 "forest2087 (1 commits)")

---

Tags

pdf-to-textforest

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k39.6k](/packages/matomo-matomo)[tempest/framework

The PHP framework that gets out of your way.

2.3k37.6k20](/packages/tempest-framework)[spatie/pdf-to-text

Extract text from a pdf

1.0k8.0M53](/packages/spatie-pdf-to-text)[pontedilana/php-weasyprint

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

791.3M19](/packages/pontedilana-php-weasyprint)[rockett/weasyprint

A feature-rich WeasyPrint wrapper for generating PDFs from HTML and CSS, with support for PDF/A, PDF/UA, attachments, and optional Laravel integration.

29233.1k](/packages/rockett-weasyprint)[dagger/dagger

Dagger PHP SDK

261.4k](/packages/dagger-dagger)

PHPackages © 2026

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