PHPackages                             doode/pdf-fusion-laravel - 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. doode/pdf-fusion-laravel

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

doode/pdf-fusion-laravel
========================

Laravel package to merge several PDF files into one.

1.0.7(4y ago)32961[1 issues](https://github.com/vitormicillo/pdf-fusion-laravel/issues)MITPHPPHP ^7.3|^7.4|^8.0

Since May 21Pushed 4y ago2 watchersCompare

[ Source](https://github.com/vitormicillo/pdf-fusion-laravel)[ Packagist](https://packagist.org/packages/doode/pdf-fusion-laravel)[ Docs](https://github.com/vitormicillo/pdf-fusion-laravel)[ RSS](/packages/doode-pdf-fusion-laravel/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (8)Used By (0)

PDF Fusion for Laravel 6 and 7
==============================

[](#pdf-fusion-for-laravel-6-and-7)

[![Latest Version on Packagist](https://camo.githubusercontent.com/885eb90e332adf1733700f97a751ed4c52a36b8899f30f06f92702b2f0921d30/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f646f6f64652f7064662d667573696f6e2d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/doode/pdf-fusion-laravel)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Quality Score](https://camo.githubusercontent.com/2d462c7413bf225f9da6892e830f86f70b43bb537087650139876cb3a09d33ba/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7669746f726d6963696c6c6f2f7064662d667573696f6e2d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/vitormicillo/pdf-fusion-laravel)[![Total Downloads](https://camo.githubusercontent.com/051a365f7559fc6b9c426cbbe0777c7fc9c3aebb265a29cd22472db90677a4bb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f646f6f64652f7064662d667573696f6e2d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/doode/pdf-fusion-laravel)

PDF Fusion for Laravel. Tested with Laravel **`7`** and **`8`**.

Advantages
----------

[](#advantages)

- Also works with PDF versions above **`1.4`**
- Works with **`PHP7.3/ 7.4/ 8.0^`** and laravel **`8`**

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

[](#installation)

You can install the package via composer:

```
composer require doode/pdf-fusion-laravel
```

If you have a linux system (Debian/Ubuntu)
------------------------------------------

[](#if-you-have-a-linux-system-debianubuntu)

```
apt-get install ghostscript
```

If you have a linux system (Arch Linux)
---------------------------------------

[](#if-you-have-a-linux-system-arch-linux)

```
pacman -S ghostscript
```

Configuration
-------------

[](#configuration)

Make the following changes at **`config/app.php`** if your laravel version does not automatically identify the package

```
'providers' => [
   ...
   Doode\PdfFusionLaravel\Providers\PdfFusionServiceProvider::class
],

'aliases' => [
   ...
   'PdfFusion' => Doode\PdfFusionLaravel\Facades\PdfFusionFacade::class
]
```

> When merging PDFs versions above 1.4 or PDF strings, a temporary PDF will be created during the process and stored in `storage/tmp` directory, therefore you may need to create it beforehand.

> **ATENTION**

> Also, note that this package requires **Ghostscript** installed on the server in order to functiona properly with PDF versions 1.5+. [Install Guide](https://www.ghostscript.com/doc/9.20/Install.htm)

Usage
-----

[](#usage)

You can add PDFs for fusion, by specifying a file path of PDF with `addPathToPDF` method, or adding PDF file as string with `addPDFString` method. The second argument of both methods is array of selected pages (`'all'` for all pages) and the third argument is PDFs orientation (portrait or landscape).

`[P] = Portrait`
`[L] = Landscape`

```
$fusion->addPathToPDF('/path/to/pdf', 'all', 'P');
$fusion->addPDFString(file_get_contents('path/to/pdf'), ['1', '2'], 'L')
```

You can set a merged PDF name by using `setFileName` method.

```
$merger->setFileName('output.pdf');
```

In the end, finnish process with `merge` or `duplexMerge` method and use one of the output options for the merged PDF. The difference bwetween two methods is, that `duplexMerge` adds blank page after each merged PDF, if it has odd number of pages.

**Available output options are:**

- `inline()`
- `download()`
- `string()`
- `save('path/to/merged.pdf')`

```
$fusion->merge();
$fusion->inline();
```

**Example usage**

```
$fusion = \PdfFusion::init();
$fusion->addPathToPDF(base_path('/vendor/doode/pdf-fusion-laravel/examples/one.pdf'), [2], 'P');
$fusion->addPDFString(file_get_contents(base_path('/vendor/doode/pdf-fusion-laravel/examples/two.pdf')), 'all', 'L');
$fusion->merge();
$fusion->save(public_path('/pdfs/output.pdf'));
```

Authors
-------

[](#authors)

- [Vitor Micillo](https://github.com/vitormicillo)

Credits
-------

[](#credits)

- **Webklex** [LaravelPDFMerger](https://github.com/Webklex/laravel-pdfmerger)

License
=======

[](#license)

The MIT License (MIT)

Copyright (c) 2020 Doode

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 88.2% 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 ~67 days

Recently: every ~58 days

Total

7

Last Release

1775d ago

PHP version history (4 changes)1.0.1PHP ^7.2

1.0.4PHP ^7.3

1.0.5PHP ^7.3|^8.0

1.0.7PHP ^7.3|^7.4|^8.0

### Community

Maintainers

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

---

Top Contributors

[![vitormicillo](https://avatars.githubusercontent.com/u/1921806?v=4)](https://github.com/vitormicillo "vitormicillo (15 commits)")[![emersonfidelon](https://avatars.githubusercontent.com/u/4026937?v=4)](https://github.com/emersonfidelon "emersonfidelon (1 commits)")[![renovate-bot](https://avatars.githubusercontent.com/u/25180681?v=4)](https://github.com/renovate-bot "renovate-bot (1 commits)")

---

Tags

laravelpdfmergerpdf mergeFUSIONpdfmergelaravel-pdf-merge

### Embed Badge

![Health badge](/badges/doode-pdf-fusion-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/doode-pdf-fusion-laravel/health.svg)](https://phpackages.com/packages/doode-pdf-fusion-laravel)
```

###  Alternatives

[webklex/laravel-pdfmerger

Generic PDF merger for Laravel

1422.6M2](/packages/webklex-laravel-pdfmerger)[lynx39/lara-pdf-merger

60176.2k](/packages/lynx39-lara-pdf-merger)

PHPackages © 2026

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