PHPackages                             iio/libmergepdf - 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. iio/libmergepdf

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

iio/libmergepdf
===============

Library for merging multiple PDFs

4.0.4(5y ago)40813.6M↑11.7%86[16 issues](https://github.com/hanneskod/libmergepdf/issues)[4 PRs](https://github.com/hanneskod/libmergepdf/pulls)11WTFPLPHPPHP ^7.1||^8.0CI failing

Since Oct 2Pushed 3mo ago15 watchersCompare

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

READMEChangelogDependencies (4)Versions (17)Used By (11)

libmergepdf
===========

[](#libmergepdf)

[![Packagist Version](https://camo.githubusercontent.com/6d548bb97062dbb3fa02e5f50bc7c6db67baef990cbce046a912c92c72d299a8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f69696f2f6c69626d657267657064662e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/iio/libmergepdf)[![Build Status](https://camo.githubusercontent.com/d488474d61c5d98a6859702d5f4739a7eee64e53e1ff41421061185d67f330a9/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f68616e6e65736b6f642f6c69626d657267657064662f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.com/github/hanneskod/libmergepdf)[![Quality Score](https://camo.githubusercontent.com/86d21b0371d5af4d7f3731847d7f366df646421a629c743aa98bddde951a7110/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f68616e6e65736b6f642f6c69626d657267657064662e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/hanneskod/libmergepdf)

PHP library for merging multiple PDFs.

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

[](#installation)

```
composer require iio/libmergepdf
```

Usage
-----

[](#usage)

Append the first ten pages of **bar.pdf** to **foo.pdf**:

```
use iio\libmergepdf\Merger;
use iio\libmergepdf\Pages;

$merger = new Merger;
$merger->addFile('foo.pdf');
$merger->addFile('bar.pdf', new Pages('1-10'));
$createdPdf = $merger->merge();
```

Bulk add files from an iterator:

```
use iio\libmergepdf\Merger;

$merger = new Merger;
$merger->addIterator(['A.pdf', 'B.pdf']);
$createdPdf = $merger->merge();
```

### Merging pdfs of version 1.5 and later

[](#merging-pdfs-of-version-15-and-later)

The default `FPDI` driver is not able handle compressed pdfs of version 1.5 or later. Circumvent this limitation by using the slightly more experimental `TCPDI` driver.

```
use iio\libmergepdf\Merger;
use iio\libmergepdf\Driver\TcpdiDriver;

$merger = new Merger(new TcpdiDriver);
```

### Using an immutable merger

[](#using-an-immutable-merger)

Immutability may be achieved by using a `driver` directly.

```
use iio\libmergepdf\Driver\Fpdi2Driver;
use iio\libmergepdf\Source\FileSource;
use iio\libmergepdf\Pages;

$merger = new Fpdi2Driver;

$createdPdf = $merger->merge(
    new FileSource('foo.pdf'),
    new FileSource('bar.pdf', new Pages('1-10'))
);
```

Known issues
------------

[](#known-issues)

- Links and other content outside a page content stream is removed at merge. This is due to limitations in FPDI and not possible to resolve with the current strategy. For more information see [FPDI](https://www.setasign.com/support/faq/fpdi/after-importing-a-page-all-links-are-gone/#question-84).
- *TCPDI* (as used in the *TcpdiDriver* for merging pdfs with newer features) does not seem to be maintained. This makes mergeing fragile for certain kinds of files, and error messages are often all but helpful. This package will not be able to fix issues in *TCPDI*. The long term solution is to switch to a different backend. Suggestions are very welcomed!

###  Health Score

62

—

FairBetter than 99% of packages

Maintenance54

Moderate activity, may be stable

Popularity68

Solid adoption and visibility

Community35

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 78.9% 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 ~199 days

Recently: every ~188 days

Total

16

Last Release

1989d ago

Major Versions

2.4.0 → 3.0.02016-03-02

3.1.1 → 4.0.02018-11-16

PHP version history (4 changes)2.0.0PHP &gt;=5.3.0

3.1.0PHP &gt;=5.6

4.0.0PHP ^7.1

4.0.4PHP ^7.1||^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/b0af6567c7f4f5518a422192675445464fdcf18acbc9459b3205da9fd446f8d0?d=identicon)[hanneskod](/maintainers/hanneskod)

---

Top Contributors

[![hanneskod](https://avatars.githubusercontent.com/u/1369274?v=4)](https://github.com/hanneskod "hanneskod (75 commits)")[![Omar-AlKayed](https://avatars.githubusercontent.com/u/87068129?v=4)](https://github.com/Omar-AlKayed "Omar-AlKayed (7 commits)")[![kaystrobach](https://avatars.githubusercontent.com/u/1185776?v=4)](https://github.com/kaystrobach "kaystrobach (6 commits)")[![md2perpe](https://avatars.githubusercontent.com/u/543239?v=4)](https://github.com/md2perpe "md2perpe (2 commits)")[![svenluijten](https://avatars.githubusercontent.com/u/11269635?v=4)](https://github.com/svenluijten "svenluijten (1 commits)")[![willoller](https://avatars.githubusercontent.com/u/127107?v=4)](https://github.com/willoller "willoller (1 commits)")[![moerphie](https://avatars.githubusercontent.com/u/12500071?v=4)](https://github.com/moerphie "moerphie (1 commits)")[![mpesari](https://avatars.githubusercontent.com/u/11061725?v=4)](https://github.com/mpesari "mpesari (1 commits)")[![proxyconcept](https://avatars.githubusercontent.com/u/620151?v=4)](https://github.com/proxyconcept "proxyconcept (1 commits)")

---

Tags

pdfpdf-mergepdfmerge

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/iio-libmergepdf/health.svg)

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

###  Alternatives

[mpdf/mpdf

PHP library generating PDF files from UTF-8 encoded HTML

4.7k77.1M493](/packages/mpdf-mpdf)[jurosh/pdf-merge

PHP PDF Merger

1522.2M5](/packages/jurosh-pdf-merge)[elibyy/tcpdf-laravel

tcpdf support for Laravel 6, 7, 8, 9, 10, 11

3542.7M5](/packages/elibyy-tcpdf-laravel)[karriere/pdf-merge

A wrapper for the TCPDF class that provides an elegant API for merging PDFs

27566.8k1](/packages/karriere-pdf-merge)[imal-h/pdf-box

The most advanced, driver-based PDF manipulation library for PHP v3.0. Supports Ghostscript, Chrome Headless (HTML to PDF), OpenSSL/FPDI (Signing), and PDFtk (Forms).

60403.9k](/packages/imal-h-pdf-box)[bithost-gmbh/pdfviewhelpers

This is a TYPO3 CMS extension that provides various Fluid ViewHelpers to generate PDF documents.

45242.7k2](/packages/bithost-gmbh-pdfviewhelpers)

PHPackages © 2026

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