PHPackages                             ztomesic/pdfextractor - 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. ztomesic/pdfextractor

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

ztomesic/pdfextractor
=====================

Easy way to split PDF

v1.7.1(8y ago)1180↓100%MITPHP

Since Feb 17Pushed 8y agoCompare

[ Source](https://github.com/Tzvonimir/PDFExtractor)[ Packagist](https://packagist.org/packages/ztomesic/pdfextractor)[ RSS](/packages/ztomesic-pdfextractor/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (10)Used By (0)

[![Build Status](https://camo.githubusercontent.com/eef753843efb7340ee20c0840497f65c20485a318d9c80e87cff8e87303837a2/68747470733a2f2f7472617669732d63692e6f72672f547a766f6e696d69722f504446457874726163746f722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Tzvonimir/PDFExtractor)

A PDF manipulator based on pdftk.

Features
--------

[](#features)

*PHPExtractor* is a PDF manipulation tool for PHP.

- Concatenate pages from several PDF files into a new PDF file
- Split a PDF into multiple one page PDF files
- Convert PDF to text
- Search PDF
- Rebuild PDF by keyword(s)
- Extract PDF by keyword(s)
- Create new directory
- Delete all files from directory

Requirements
------------

[](#requirements)

- The `pdftk` command must be installed on your system

Installation
------------

[](#installation)

You should use use [composer](https://getcomposer.org/) to install this library.

```
composer require ztomesic/pdfextractor

```

Examples
--------

[](#examples)

use ZTomesic\\PDFExtractor\\PDFExtractor;

### PDF File class

[](#pdf-file-class)

use ZTomesic\\PDFExtractor\\PDF;

$pdf = new PDF('/file/location/file.pdf');

#### Burst

[](#burst)

Split a PDF file into one file per page.

```
$file = new PDF('/file/location/file.pdf');

PDFExtractor::burst($file)->save('/location/where/to/burst/');
```

#### Cat

[](#cat)

Concatenate pages from several PDF files into a new PDF file.

```
PDFExtractor::cat(/location/of/pdf/files/, '*.pdf')->save('location/where/to/save/', 'name_of_new_file.pdf');
```

#### PDF To Text

[](#pdf-to-text)

Convert PDF to text.

```
$pdf = new PDF('/file/location/file.pdf');

PDFExtractor::PDFToText($pdf);
```

#### Search PDF

[](#search-pdf)

Search PDF file by keywoard(s).

```
$pdf = new PDF('/file/location/file.pdf');

PDFExtractor::searchPDF($pdf, 'wordToSearchBy');
```

#### Rebuild PDF By Keyword

[](#rebuild-pdf-by-keyword)

Rebuild PDF(s) by keyword(s)

```
$pdf = new PDF('/file/location/file.pdf');

PDFExtractor::rebuildPDFByKeyword($pdf, '/location/where/to/burst/', '/location/where/to/rebuild/', 'keyword_to_rebuild_by');
```

#### Relocate File

[](#relocate-file)

Change location of specific file

```
$pdf = new PDF('/file/location/file.pdf');

PDFExtractor::relocateFile($pdf, '/new/file/path/');
```

#### Clear Folder

[](#clear-folder)

Delete all content from folder.

```
$excludedFiles = ['excluded_file.pdf'];

PDFExtractor::clearFolder('/path/to/directory/', $excludedFiles);
```

#### Remove Directory

[](#remove-directory)

Delete directory and content.

```
PDFExtractor::removeDirectory('/path/to/directory/');
```

#### Create Directory

[](#create-directory)

Create new directory.

```
PDFExtractor::createDirectory('/path/to/directory/name/');
```

#### Search and rebuild

[](#search-and-rebuild)

Search PDF(s) and rebuild by keyword.

```
$pdf = new PDF('/file/location/file.pdf');
$PDFExtractor = PDFExtractor::burst($file)->save('/location/where/to/burst/');

$PDFExtractor->searchMultiplePDFByKeywords('/location/where/to/burst/', 'wordToSearchBy')
             ->changeFileLocation('/location/where/to/rebuild/')
             ->mergePDFByKeywords();
```

#### Extract Metadata To Array

[](#extract-metadata-to-array)

Extract metadata to array.

```
PDFExtractor::extractMetadata('/path/to/directory/name/')
    ->save('/location/where/to/save/', 'name_of_file.txt')
    ->toArray();
```

#### Extract Metadata To String

[](#extract-metadata-to-string)

Extract metadata to string.

```
PDFExtractor::extractMetadata('/path/to/directory/name/')
    ->save('/location/where/to/save/', 'name_of_file.txt')
    ->toString();
```

###  Health Score

30

—

LowBetter than 65% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity69

Established project with proven stability

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 ~4 days

Total

9

Last Release

2966d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/152c1cbee76bcc28e281aaf72915c6e204be56ea5a3cda4cd136ecd0db45df68?d=identicon)[ZTomesic](/maintainers/ZTomesic)

---

Tags

searchpdfpdftk

### Embed Badge

![Health badge](/badges/ztomesic-pdfextractor/health.svg)

```
[![Health](https://phpackages.com/badges/ztomesic-pdfextractor/health.svg)](https://phpackages.com/packages/ztomesic-pdfextractor)
```

###  Alternatives

[barryvdh/laravel-dompdf

A DOMPDF Wrapper for Laravel

7.3k87.6M275](/packages/barryvdh-laravel-dompdf)[tecnickcom/tcpdf

TCPDF is a PHP class for generating PDF documents and barcodes.

4.5k101.8M472](/packages/tecnickcom-tcpdf)[mpdf/mpdf

PHP library generating PDF files from UTF-8 encoded HTML

4.7k77.1M490](/packages/mpdf-mpdf)[knplabs/knp-snappy

PHP library allowing thumbnail, snapshot or PDF generation from a url or a html page. Wrapper for wkhtmltopdf/wkhtmltoimage.

4.5k68.3M55](/packages/knplabs-knp-snappy)[spatie/browsershot

Convert a webpage to an image or pdf using headless Chrome

5.2k32.1M100](/packages/spatie-browsershot)[mikehaertl/php-pdftk

A PDF conversion and form utility based on pdftk.

1.0k10.9M11](/packages/mikehaertl-php-pdftk)

PHPackages © 2026

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