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

ActiveLibrary

quangvule/pdf-to-text
=====================

Extract text from a pdf

1.0.1(10y ago)017MITPHPPHP ^7.0

Since Dec 31Pushed 9y ago1 watchersCompare

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

READMEChangelogDependencies (2)Versions (4)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)[![SensioLabsInsight](https://camo.githubusercontent.com/63db229c6159f10c1e7bbe6a57693aab4ce46c9bb18ad12f235f8a89802b823a/68747470733a2f2f696d672e736869656c64732e696f2f73656e73696f6c6162732f692f39643835653864642d623434342d346265662d613564352d6661613766326438643662622e7376673f7374796c653d666c61742d737175617265)](https://insight.sensiolabs.com/projects/9d85e8dd-b444-4bef-a5d5-faa7f2d8d6bb)[![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.

```
 \Spatie\PdfToText\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:

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

```
 \Spatie\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)

- [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

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 74.4% 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 ~38 days

Total

3

Last Release

3707d ago

Major Versions

0.0.1 → 1.0.02015-12-31

### Community

Maintainers

![](https://www.gravatar.com/avatar/0c89a98c544fca1cdf7bbefe91803e0d469466d7c43feb59d8063fcc3e11a75e?d=identicon)[quangvule](/maintainers/quangvule)

---

Top Contributors

[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (29 commits)")[![vuxlee584](https://avatars.githubusercontent.com/u/7167251?v=4)](https://github.com/vuxlee584 "vuxlee584 (7 commits)")[![sebastiandedeyne](https://avatars.githubusercontent.com/u/1561079?v=4)](https://github.com/sebastiandedeyne "sebastiandedeyne (3 commits)")

---

Tags

spatiepdf-to-text

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[spatie/image

Manipulate images with an expressive API

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

Easily optimize images using PHP

2.9k71.3M109](/packages/spatie-image-optimizer)[spatie/pdf-to-text

Extract text from a pdf

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

Dump databases

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

Monitor the health of a Laravel application

85810.0M83](/packages/spatie-laravel-health)[spatie/async

Asynchronous and parallel PHP with the PCNTL extension

2.8k4.5M37](/packages/spatie-async)

PHPackages © 2026

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