PHPackages                             php-pdfbox/php-pdfbox - 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. php-pdfbox/php-pdfbox

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

php-pdfbox/php-pdfbox
=====================

PHP-PDFBox

v2.0.4(2y ago)72.1k↓33.3%7[1 issues](https://github.com/php-pdfbox/php-pdfbox/issues)MITPHPPHP ^8.1

Since Jul 9Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/php-pdfbox/php-pdfbox)[ Packagist](https://packagist.org/packages/php-pdfbox/php-pdfbox)[ Docs](https://github.com/php-pdfbox/php-pdfbox)[ RSS](/packages/php-pdfbox-php-pdfbox/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (2)Versions (11)Used By (0)

PHP-PDFbox
==========

[](#php-pdfbox)

PHP-PDFBox is a tiny library which acts as a wrapper facilitating the use of PDFBox  in PHP.

It provides a simple API for calling the pdfbox-app.jar. The library is currently restricted to functionality provided by PDFbox's command-line utilities. It currently supports PDFBox version 2.

PDFBox is published under the Apache License v2.0 and is described as "The Apache PDFBox® library is an open source Java tool for working with PDF documents."

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

[](#installation)

It is recommended to install PHP-PDFBox through [Composer](http://getcomposer.org) :

```
{
    "require": {
        "php-pdfbox/php-pdfbox": "^2.0"
    }
}
```

pdfbox-app.jar is included in the installation. You can/should verify the integrity of pdfbox-app.jar with the PGP signatures available at .

Main API usage:
---------------

[](#main-api-usage)

Basic usage can be done as follows:

```
$file = new \Pdfbox\Processor\PdfFile(
    new Pdfbox(
        '/path/to/java',
        '/path/to/pdfbox-app.jar'
    );
);

// Convert pdf to text
echo $file->toText('test.pdf');
```

(Providing a Logger object is optional in v2.0.2+.) To use with psr/log and a PSR-3 compliant logger, do something like:

```
use Psr\Log\LoggerInterface;
use MyPSR3Logger;

class Foo
{
    private $logger;

    public function __construct(LoggerInterface $logger = null){
        $this->logger = $logger;
    }

    public function doPdfBox(){
        try {
            $file = new \Pdfbox\Processor\PdfFile(
                new Pdfbox(
                    '/path/to/java',
                    '/path/to/pdfbox-app.jar',
                    $this->logger;
                );
            );
            // Convert pdf to text
            echo $file->toText('test.pdf');
        } catch (Exception $e) {
            $this->logger->error($e->getMessage(), ['exception', $e->backtrace()]);
        }
    }
}
$myLogger = new MyPSR3Logger();
$foo = new Foo($myLogger);
```

See `examples/ConsoleLogger.php` for a standard PSR3 compliant logger class that can be be copied and adapted.

See `examples/*.php` for more examples.

API Documentation
-----------------

[](#api-documentation)

HTML Documentation generated by [phpDocumentor](https://phpdoc.org/) can be found in [`docs/api`](docs/api/index.html).

License
-------

[](#license)

PHP-Pdfbox is released under MIT License

See LICENSE file for more information.

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance52

Moderate activity, may be stable

Popularity28

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity77

Established project with proven stability

 Bus Factor1

Top contributor holds 86.7% 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 ~273 days

Recently: every ~0 days

Total

8

Last Release

958d ago

Major Versions

v1.0.4 → v2.0.02023-10-03

PHP version history (3 changes)1.0.0PHP ^7.1

v1.0.4PHP ^7.1 || ^8

v2.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/49ccca7d56900f1159e697b71c14bc3db6cfade5a196a409c28c4713a647bf5e?d=identicon)[temp](/maintainers/temp)

---

Top Contributors

[![redcuillin](https://avatars.githubusercontent.com/u/1464131?v=4)](https://github.com/redcuillin "redcuillin (13 commits)")[![temp](https://avatars.githubusercontent.com/u/216128?v=4)](https://github.com/temp "temp (2 commits)")

---

Tags

pdfphpphp-librarypdfpdfbox

### Embed Badge

![Health badge](/badges/php-pdfbox-php-pdfbox/health.svg)

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

###  Alternatives

[mpdf/mpdf

PHP library generating PDF files from UTF-8 encoded HTML

4.7k77.1M493](/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.3M56](/packages/knplabs-knp-snappy)[spatie/browsershot

Convert a webpage to an image or pdf using headless Chrome

5.2k32.1M102](/packages/spatie-browsershot)[chrome-php/chrome

Instrument headless chrome/chromium instances from PHP

2.6k4.5M64](/packages/chrome-php-chrome)[sensiolabs/gotenberg-bundle

A Symfony bundle that provides seamless integration with Gotenberg for generating PDFs and screenshots from various sources (HTML, Markdown, Office documents, URLs) with a clean, builder-based API.

210210.4k2](/packages/sensiolabs-gotenberg-bundle)[pontedilana/php-weasyprint

PHP library allowing PDF generation from an url or a html page. Wrapper for Kozea/WeasyPrint.

761.1M7](/packages/pontedilana-php-weasyprint)

PHPackages © 2026

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