| Package Data | |
|---|---|
| Maintainer Username: | ottosmops |
| Maintainer Contact: | kraenzle@k-r.ch (ak) |
| Package Create Date: | 2016-11-09 |
| Package Last Update: | 2025-09-04 |
| Language: | PHP |
| License: | MIT |
| Last Refreshed: | 2025-11-04 03:03:15 |
| Package Statistics | |
|---|---|
| Total Downloads: | 135,612 |
| Monthly Downloads: | 2,390 |
| Daily Downloads: | 98 |
| Total Stars: | 5 |
| Total Watchers: | 3 |
| Total Forks: | 1 |
| Total Open Issues: | 0 |
This package provides a class to extract text from a pdf. It is more or less a PHP 5.6 compatible copy of spatie/pdf-to-text.
\Ottosmops\Pdftotext\Extract::getText('/path/to/file.pdf') //returns the text from the pdf
The Package uses pdftotext. Make sure that this is installed: which pdftotext
For Installation see: poppler-utils
If the installed binary is not found ("The command "which pdftotext" failed.") you can pass the full path to the _constructor (see below) or use putenv('PATH=$PATH:/usr/local/bin/:/usr/bin') (with the dir where pdftotext lives) before you call the class Extract.
composer require ottosmops/pdftotext
Extracting text from a pdf:
$text = (new Extract())
->pdf('file.pdf')
->text();
You can set the binary and you can specify options:
$text = (new Extract('/path/to/pdftotext'))
->pdf('path/to/file.pdf')
->options('-layout')
->text();
Default options are: -eol unix -enc UTF-8 -raw
The MIT License (MIT). Please see License File for more information.