PHPackages                             raudius/phpdf - 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. raudius/phpdf

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

raudius/phpdf
=============

Another mediocre PHP library to modify PDFs.

1.0.3(3y ago)02.5kCC0-1.0PHPPHP ^7.2

Since May 24Pushed 3y ago1 watchersCompare

[ Source](https://github.com/Raudius/phpdf)[ Packagist](https://packagist.org/packages/raudius/phpdf)[ RSS](/packages/raudius-phpdf/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (4)Versions (5)Used By (0)

A mediocre library for modifying PDF files.

❗ Important ❗
-------------

[](#-important-)

Be warned that this library is not production ready!

- **QPDF dependant**
    To use this library you need to have qpdf installed on your system.
- **Performance**
    Although some attention has been put to simple optimisations, this library is far from optimal particularly in terms of memory consumption. Additionally, it relies heavily on repeated read/writes to temp files.
- **Compatibility**
    I am only testing this library on Linux with qpdf &gt;=v9.1.1.
- **Security**
    This library directly interfaces with the shell. Do NOT pass along user-defined values to any function on this library.

📖 How it works
--------------

[](#-how-it-works)

### Loading PDFs

[](#loading-pdfs)

There are multiple ways to get a PDF file going, the simplest is to create a stub file (an empty PDF file ready to receive data):

```
$pdf = Phpdf::create();
```

You can also load directly from an existing PDF. In this method you can specify whether you want operations performed on the pdf to overwrite the existing file (false by default).

```
$pdf = Phpdf::fopen('example.pdf', true);           // Overwrite = true
$pdf = Phpdf::fopen(fopen('example.pdf', 'rb'));    // Overwrite = false
```

You can also create a PDF directly from a raw PDF string, this is the least advisable method as it requires loading the entire file into memory:

```
$pdf = Phpdf::create(file_get_contents('example.pdf'));
```

### PDF operations

[](#pdf-operations)

You can perform different operations on your `Phpdf` objects. You can specify the pdf object in the execution argument to apply the changes directly to that file.
For more detailed information on each operation you can read their corresponding PHPdoc.

```
// Combine 3 PDF files into 1
$pdf_merged = (new Merge([
  Phpdf::fopen('file1.pdf'),
  Phpdf::fopen('file2.pdf'),
  Phpdf::fopen('file3.pdf')
]))->execute();

// Keep just the 1st, 3rd and 4th pages.
(new Trim($pdf_merged, '1,3,4'))->execute($pdf_merged);
```

### Save PDF

[](#save-pdf)

Unless you specified to overwrite an input file you will need to save your resulting PDF manually:

```
$pdf = Phpdf::create();
$pdf->saveAs('copy1.pdf');
$pdf->saveAs('copy2.pdf');
$pdf->saveAs('copy3.pdf');
```

🔓 License
---------

[](#-license)

There is no license attached to this code, because I have no desire to claim ownership of it. If you wish to use this against your better judgement and require a license, you may use it under any fully permissive license (Beerware, WTFPL, CC0...)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~25 days

Total

4

Last Release

1377d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3178979?v=4)[Raul Ferreira Fuentes](/maintainers/Raudius)[@Raudius](https://github.com/Raudius)

---

Top Contributors

[![Raudius](https://avatars.githubusercontent.com/u/3178979?v=4)](https://github.com/Raudius "Raudius (12 commits)")

---

Tags

pdftoolqpdf

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/raudius-phpdf/health.svg)

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

###  Alternatives

[barryvdh/laravel-dompdf

A DOMPDF Wrapper for Laravel

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

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

4.5k101.8M473](/packages/tecnickcom-tcpdf)[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)[mikehaertl/phpwkhtmltopdf

A slim PHP wrapper around wkhtmltopdf with an easy to use and clean OOP interface

1.6k20.0M44](/packages/mikehaertl-phpwkhtmltopdf)

PHPackages © 2026

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