Extract text, glyphs, words and metrics from PDF documents with PHP


Extract text, glyphs, words and metrics from PDF documents with PHP

PDF Text extraction with PHP

The SetaPDF-Extractor component is written in PHP and allows PHP developers to extract textual content from existing PDF documents.

Beside extracting text it is also possible to extract glyphs, words or groups of words and their positions and bounding boxes through different extraction strategies. 

A simple text extraction process of a single page will look like:


// create a document instance
$document = \SetaPDF_Core_Document::loadByFilename('Laboratory-Report.pdf');

// create an extractor instance
$extractor = new \SetaPDF_Extractor($document);

// get the plain text from page 1
$result = $extractor->getResultByPageNumber(1);

// output
echo '<pre>';
echo htmlspecialchars($result);
echo '</pre>';

In Action [See all demos]

Extract Plain Text

Extract plain text from a PDF document.

Mark Word Groups

Mark word groups of visible entities.

More demos are available here.

Examples of Usage

  • Create a search index for PDF documents
    Extract the plain text from PDF documents to create a search index.
  • Extract data from a specific locations on a PDF page
    For example an invoice number, sender name, po number,...
  • Highlight words in a PDF document
    A full indexed search catalog may allow your customers to hightlight the words in the PDF document due a Highlight Annotation.


Questions about SetaPDF-Extractor?

If you are searching for a feature or have any question regarding this or any other product, contact us at support@setasign.com.

Want to stay up to date?

Then subscribe to our newsletter:

E-mail seems to be invalid.
Please confirm that you have read our data privacy statement.

Do you like this product?

Then it would be awesome, if you‘d recommend it to your friends!