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

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

hello-solucoes/pdf-to-text
==========================

Extract text from a pdf

1.1.1(7y ago)024.6k↓26.5%MITPHPPHP ^7.0CI failing

Since Dec 31Pushed 5y agoCompare

[ Source](https://github.com/Hello-Solucoes/pdf-to-text)[ Packagist](https://packagist.org/packages/hello-solucoes/pdf-to-text)[ Docs](https://github.com/spatie/pdf-to-text)[ RSS](/packages/hello-solucoes-pdf-to-text/feed)WikiDiscussions master Synced 1mo ago

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

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

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

[![Latest Version on Packagist](https://camo.githubusercontent.com/99a626f2452c0aaff605e496890d8d0b8fd56bcb13a39dc86333193d5d758fa0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7370617469652f7064662d746f2d746578742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/pdf-to-text)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/d44a5e55f16ff3aa070729c50b3352ed7ea0afd2bb13ef0e4c36476368715a51/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7370617469652f7064662d746f2d746578742f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/spatie/pdf-to-text)[![Quality Score](https://camo.githubusercontent.com/a64fc37b6a268cf565afb5d048859a8018a897a582f3c832cd92d801a6895ec3/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7370617469652f7064662d746f2d746578742e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/spatie/pdf-to-text)[![Total Downloads](https://camo.githubusercontent.com/606fb0e5d3ffda6e365fe92f6d61e323bebfe1a852727172c54554dd511f36be/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7370617469652f7064662d746f2d746578742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/pdf-to-text)

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

```
use Spatie\PdfToText\Pdf;

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

Spatie is a webdesign agency based in Antwerp, Belgium. You'll find an overview of all our open source projects [on our website](https://spatie.be/opensource).

Postcardware
------------

[](#postcardware)

You're free to use this package (it's [MIT-licensed](LICENSE.md)), but if it makes it to your production environment you are required to send us a postcard from your hometown, mentioning which of our package(s) you are using.

Our address is: Spatie, Samberstraat 69D, 2060 Antwerp, Belgium.

The best postcards will get published on the open source page on our website.

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:

```
echo Pdf::getText('book.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 Pdf('/custom/path/to/pdftotext'))
    ->setPdf('book.pdf')
    ->text();
```

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

```
echo Pdf::getText('book.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 Pdf())
    ->setPdf('table.pdf')
    ->setOptions(['layout', 'r 96'])
    ->text()
;
```

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

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

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)

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

About Spatie
------------

[](#about-spatie)

Spatie is a webdesign agency based in Antwerp, Belgium. You'll find an overview of all our open source projects [on our website](https://spatie.be/opensource).

License
-------

[](#license)

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

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 63.1% 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 ~196 days

Recently: every ~276 days

Total

7

Last Release

2610d ago

Major Versions

0.0.1 → 1.0.02015-12-31

### Community

Maintainers

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

---

Top Contributors

[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (41 commits)")[![nyamsprod](https://avatars.githubusercontent.com/u/51073?v=4)](https://github.com/nyamsprod "nyamsprod (16 commits)")[![sebastiandedeyne](https://avatars.githubusercontent.com/u/1561079?v=4)](https://github.com/sebastiandedeyne "sebastiandedeyne (4 commits)")[![srmklive](https://avatars.githubusercontent.com/u/839335?v=4)](https://github.com/srmklive "srmklive (1 commits)")[![JayBizzle](https://avatars.githubusercontent.com/u/340752?v=4)](https://github.com/JayBizzle "JayBizzle (1 commits)")[![carusogabriel](https://avatars.githubusercontent.com/u/16328050?v=4)](https://github.com/carusogabriel "carusogabriel (1 commits)")[![andersondanilo](https://avatars.githubusercontent.com/u/5572326?v=4)](https://github.com/andersondanilo "andersondanilo (1 commits)")

---

Tags

spatiepdf-to-text

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[spatie/pdf-to-text

Extract text from a pdf

1.0k6.7M40](/packages/spatie-pdf-to-text)[spatie/pdf-to-image

Convert a pdf to an image

1.4k15.2M64](/packages/spatie-pdf-to-image)[spatie/simple-excel

Read and write simple Excel and CSV files

1.4k9.9M48](/packages/spatie-simple-excel)[spatie/image

Manipulate images with an expressive API

1.4k54.4M138](/packages/spatie-image)[spatie/db-dumper

Dump databases

1.2k25.9M69](/packages/spatie-db-dumper)[spatie/laravel-pdf

Create PDFs in Laravel apps

9963.4M12](/packages/spatie-laravel-pdf)

PHPackages © 2026

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