PHPackages                             igeek/pdfservice - 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. igeek/pdfservice

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

igeek/pdfservice
================

some desc

v1.0.1(3mo ago)4106↓100%1[1 PRs](https://github.com/coolamit/igeek-pdfservice/pulls)MITPHPPHP ^8.3CI passing

Since Jan 8Pushed 1mo agoCompare

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

READMEChangelog (2)Dependencies (15)Versions (4)Used By (0)

iGeek PdfService
================

[](#igeek-pdfservice)

A Laravel package for generating PDFs using [Gotenberg](https://gotenberg.dev/). Convert Blade views or raw HTML to PDF with support for headers, footers, custom page sizes, and more.

If you do not have Gotenberg set up, you can quickly set it up using Docker. See [coolamit/pdfservice](https://github.com/coolamit/pdfservice) to get started.

---

[![GitHub Tests Action Status](https://camo.githubusercontent.com/5b3abe110df4511666cdabac37faff0f8adb8408c2d7b91d5ff3e0167ed5bf05/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f636f6f6c616d69742f696765656b2d706466736572766963652f74657374732e796d6c3f6272616e63683d6d6173746572266c6162656c3d5465737473)](https://github.com/coolamit/igeek-pdfservice/actions/workflows/tests.yml)[![GitHub PHPStan Action Status](https://camo.githubusercontent.com/7cc50daa155bf337530cdab4f925d70f93dfef87c6eb62bed38f4b4f49ea86c0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f636f6f6c616d69742f696765656b2d706466736572766963652f7068707374616e2e796d6c3f6272616e63683d6d6173746572266c6162656c3d5048505374616e)](https://github.com/coolamit/igeek-pdfservice/actions/workflows/phpstan.yml)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/deb2cfae44cbadad744e7d642242397fd0ca8fcc4068e1f177ce17dbe911acaa/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f636f6f6c616d69742f696765656b2d706466736572766963652f636f64652d7374796c652e796d6c3f6272616e63683d6d6173746572266c6162656c3d436f64652532305374796c65)](https://github.com/coolamit/igeek-pdfservice/actions/workflows/code-style.yml)

[![License](https://camo.githubusercontent.com/6e953129dab09117b2182524b223259d30c4141cf5a56e8d317fdfb9207cb2a9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f636f6f6c616d69742f696765656b2d706466736572766963653f636f6c6f723d626c7565266c6162656c3d4c6963656e7365)](https://camo.githubusercontent.com/6e953129dab09117b2182524b223259d30c4141cf5a56e8d317fdfb9207cb2a9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f636f6f6c616d69742f696765656b2d706466736572766963653f636f6c6f723d626c7565266c6162656c3d4c6963656e7365)[![PHP](https://camo.githubusercontent.com/8aa85626c1c0824b4ccd25ccf9a6bbbce16f020bed8aede9a1c3408fd2139b76/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f696765656b2f706466736572766963653f636f6c6f723d626c7565266c6162656c3d504850)](https://camo.githubusercontent.com/8aa85626c1c0824b4ccd25ccf9a6bbbce16f020bed8aede9a1c3408fd2139b76/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f696765656b2f706466736572766963653f636f6c6f723d626c7565266c6162656c3d504850)[![Latest Version on Packagist](https://camo.githubusercontent.com/fad41b54ad594113ec6d9f56aad66a91b4e028a6a82c0249291e33cd568653f2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696765656b2f706466736572766963652e7376673f6c6162656c3d5061636b6167697374)](https://packagist.org/packages/igeek/pdfservice)

---

The API of this package is inspired by [spatie/laravel-pdf](https://github.com/spatie/laravel-pdf) (which is an excellent package by Spatie), but does not have a Node.js dependency and uses Gotenberg which is written in Golang.

Minimum Requirements
--------------------

[](#minimum-requirements)

- PHP 8.3
- Laravel 11.x
- A running [Gotenberg](https://gotenberg.dev/) server

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

[](#installation)

Install the package via Composer:

```
composer require igeek/pdfservice
```

Publish the config file:

```
php artisan vendor:publish --tag="pdfservice-config"
```

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

[](#configuration)

Add these environment variables to your `.env` file:

```
PDFSERVICE_URL=http://localhost:3000
PDFSERVICE_API_KEY=your-api-key
```

Here the `PDFSERVICE_URL` is the URL where you can access your Gotenberg server and `PDFSERVICE_API_KEY` is the API key if you have authentication enabled.

The published config file (`config/pdfservice.php`):

```
return [
    'url' => env('PDFSERVICE_URL'),
    'key' => env('PDFSERVICE_API_KEY'),
];
```

Usage
-----

[](#usage)

### Basic Usage with Blade Views

[](#basic-usage-with-blade-views)

```
use Igeek\PdfService\Facades\Pdf;

// Generate and save a PDF
Pdf::view('pdf.invoice', ['invoice' => $invoice])
    ->save('invoices/invoice-001.pdf');

// Generate and download
return Pdf::view('pdf.invoice', ['invoice' => $invoice])->download('invoice.pdf');

// Display inline in browser
return Pdf::view('pdf.invoice', ['invoice' => $invoice])->inline('invoice.pdf');
```

### Using Raw HTML

[](#using-raw-html)

```
Pdf::html('Hello WorldThis is a PDF.')
    ->save('hello.pdf');
```

### Headers and Footers

[](#headers-and-footers)

```
Pdf::view('pdf.content', $data)
    ->headerView('pdf.header', ['title' => 'My Report'])
    ->footerView('pdf.footer')
    ->save('report.pdf');

// Or with raw HTML
Pdf::view('pdf.content', $data)
    ->headerHtml('Header')
    ->footerHtml('Page @pageNumber of @totalPages')
    ->save('report.pdf');
```

### Page Formats

[](#page-formats)

Available formats: `a0`, `a1`, `a2`, `a3`, `a4`, `a5`, `a6`, `letter`, `legal`, `tabloid`

```
use Igeek\PdfService\Enums\Format;

// Using enum
Pdf::view('pdf.content', $data)
    ->format(Format::Letter)
    ->save('letter.pdf');

// Using string
Pdf::view('pdf.content', $data)
    ->format('legal')
    ->save('legal.pdf');
```

### Custom Page Size

[](#custom-page-size)

Set custom dimensions in inches `[width, height]`:

```
Pdf::view('pdf.content', $data)
    ->size([8.5, 14])  // Custom size in inches
    ->save('custom.pdf');
```

### Orientation

[](#orientation)

```
Pdf::view('pdf.content', $data)
    ->landscape()
    ->save('landscape.pdf');

Pdf::view('pdf.content', $data)
    ->portrait()  // Default
    ->save('portrait.pdf');
```

### Margins

[](#margins)

Set margins in inches (top, right, bottom, left):

```
Pdf::view('pdf.content', $data)
    ->margins(1, 0.5, 1, 0.5)
    ->save('with-margins.pdf');
```

**Note:** When headers or footers are set and margins aren't explicitly defined, top/bottom margins automatically adjust to 1 inch.

### Wait Delay

[](#wait-delay)

Control how long Chromium waits before capturing the PDF (useful for JavaScript-heavy content):

```
Pdf::view('pdf.content', $data)
    ->waitDelay('1s')  // Default: 500ms
    ->save('delayed.pdf');
```

### Storage Disk

[](#storage-disk)

Specify which Laravel filesystem disk to use for saving:

```
Pdf::view('pdf.content', $data)
    ->disk('s3')
    ->save('reports/monthly.pdf');
```

Blade Directives
----------------

[](#blade-directives)

Use these directives in your PDF Blade views:

### Page Number

[](#page-number)

```

    Page @pageNumber of @totalPages

```

### Page Break

[](#page-break)

```
First page content
@pageBreak
Second page content
```

### Inline Images

[](#inline-images)

Embed images as base64 from storage paths:

```
@inlinedImage('logos/company.png')
```

External URLs are passed through as is.

Output Methods
--------------

[](#output-methods)

### Save to Storage

[](#save-to-storage)

```
$success = Pdf::view('pdf.content', $data)->save('path/to/file.pdf');
```

### Download Response

[](#download-response)

```
return Pdf::view('pdf.content', $data)->download('filename.pdf');
```

### Inline Response

[](#inline-response)

Display PDF in browser:

```
return Pdf::view('pdf.content', $data)->inline('filename.pdf');
```

### Get Raw Content

[](#get-raw-content)

```
$pdfContent = Pdf::view('pdf.content', $data)->content();
```

Custom API Credentials
----------------------

[](#custom-api-credentials)

Use different credentials to access Gotenberg API for specific operations:

```
use Igeek\PdfService\Facades\Pdf;

Pdf::using('https://other-gotenberg.example.com', 'other-api-key')
    ->view('pdf.content', $data)
    ->save('document.pdf');
```

Fluent Interface
----------------

[](#fluent-interface)

All methods support chaining:

```
Pdf::view('pdf.invoice', $data)
    ->headerView('pdf.header')
    ->footerView('pdf.footer')
    ->format(Format::A4)
    ->landscape()
    ->margins(1, 0.75, 1, 0.75)
    ->waitDelay('500ms')
    ->disk('local')
    ->name('invoice.pdf')
    ->save('invoices/2024/invoice-001.pdf');
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

License
-------

[](#license)

This package is released under MIT License (MIT). Please see [License](LICENSE.md) for more information.

###  Health Score

45

—

FairBetter than 92% of packages

Maintenance91

Actively maintained with recent releases

Popularity17

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85.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 ~11 days

Total

2

Last Release

109d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/533c6e5fe6bfa8db3c771774e4d6daa34fbe7aa047da77783656ac7e196ed67c?d=identicon)[amit\_gupta](/maintainers/amit_gupta)

---

Top Contributors

[![coolamit](https://avatars.githubusercontent.com/u/1511590?v=4)](https://github.com/coolamit "coolamit (12 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

gotenberglaravelpdfpdf-generationphplaraveligeekpdfservice

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/igeek-pdfservice/health.svg)

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

###  Alternatives

[spatie/laravel-pdf

Create PDFs in Laravel apps

9963.4M11](/packages/spatie-laravel-pdf)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)

PHPackages © 2026

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