PHPackages                             mikailfaruqali/pdf - 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. mikailfaruqali/pdf

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

mikailfaruqali/pdf
==================

Blazing-fast, modern HTML to PDF converter for Laravel powered by headless Chrome and Go.

1.0.0(today)00MITHTMLPHP ^8.4

Since Aug 29Pushed todayCompare

[ Source](https://github.com/mikailfaruqali/go-print)[ Packagist](https://packagist.org/packages/mikailfaruqali/pdf)[ RSS](/packages/mikailfaruqali-pdf/feed)WikiDiscussions main Synced today

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

PDF for Laravel
===============

[](#pdf-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/b92d461baa7df436d307f5c283b2b3a2a9348e2f89ee170ab5a215ad1d96ae43/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d696b61696c6661727571616c692f7064662e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mikailfaruqali/pdf)[![Total Downloads](https://camo.githubusercontent.com/79d6ede980bdac5295d7c9c6090df3489c6041d3d587e91c7144ffdcec15588c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d696b61696c6661727571616c692f7064662e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mikailfaruqali/pdf)[![License](https://camo.githubusercontent.com/942e017bf0672002dd32a857c95d66f28c5900ab541838c6c664442516309c8a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c61742d737175617265)](LICENSE)

A modern, high-performance HTML-to-PDF converter for Laravel 11+ and PHP 8.4+, powered by headless Chrome / Chromium and the compiled Go binary `pdf`.

---

Features
--------

[](#features)

- 🚀 **Blazing Fast**: Direct headless Chrome execution via a lightweight Go core.
- 🎨 **Modern CSS**: Full support for CSS Grid, Flexbox, Tailwind CSS, SVG, custom fonts, and `@page` rules.
- 📑 **Headers, Footers &amp; Watermarks**: Multi-fragment support with dynamic `{page}` and `{pages}` placeholders.
- 🛠️ **Developer Friendly**: Fluent, expressive API with first-class Laravel `Renderable` (Blade views) support.
- 📦 **Automated Binary Installer**: Built-in `php artisan pdf:install` to download pre-built binaries for your OS/architecture.

---

Requirements
------------

[](#requirements)

- PHP **8.2+**, **8.3+**, **8.4+**, **8.5+**
- Laravel **10.0+**, **11.0+**, **12.0+**, or **13.0+**
- Google Chrome, Chromium, Brave, or Microsoft Edge installed on the host system

---

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

[](#installation)

Install the package via Composer:

```
composer require mikailfaruqali/pdf
```

Publish the configuration file (optional):

```
php artisan vendor:publish --tag=pdf-config
```

Download and install the native Go binary for your platform:

```
php artisan pdf:install
```

Verify your environment (checks both `pdf` binary and headless browser):

```
php artisan pdf:check
```

---

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

[](#configuration)

The published `config/pdf.php` file allows you to customize defaults:

```
return [
    'binary_path' => env('PDF_BINARY_PATH'),
    'chrome_path' => env('PDF_CHROME_PATH'),
    'timeout'     => (int) env('PDF_TIMEOUT', 120),
    'temp_path'   => env('PDF_TEMP_PATH'),
];
```

---

Basic Usage
-----------

[](#basic-usage)

### Using Blade Views

[](#using-blade-views)

You can pass standard strings or any Laravel `Renderable` (such as `view()`):

```
use PDF\Facades\Pdf;

// Download PDF as response
return Pdf::make()
    ->content(view('invoices.show', ['invoice' => $invoice]))
    ->paper('A4')
    ->download('invoice-1001.pdf');

// Display inline in browser
return Pdf::make()
    ->content(view('reports.monthly'))
    ->inline('monthly-report.pdf');

// Save directly to disk
$path = Pdf::make()
    ->content('Hello World')
    ->save(storage_path('app/exports/hello.pdf'));

// Get raw PDF bytes
$pdfBytes = Pdf::make()
    ->content('Raw Output')
    ->get();
```

---

Advanced Options
----------------

[](#advanced-options)

### Headers, Footers &amp; Page Numbers

[](#headers-footers--page-numbers)

Headers and footers support dynamic placeholders `{page}` (or `{pageNumber}`) and `{pages}` (or `{totalPages}`), as well as math expressions like `{page+1}`:

```
return Pdf::make()
    ->content(view('documents.contract'))
    ->header(view('pdf.header'))
    ->footer('Page {page} of {pages}')
    ->headerHeight('25mm')
    ->footerHeight('15mm')
    ->headerSpacing('4mm')
    ->footerSpacing('4mm')
    ->download('contract.pdf');
```

### Watermark

[](#watermark)

```
return Pdf::make()
    ->content(view('invoices.preview'))
    ->watermark('CONFIDENTIAL')
    ->watermarkOpacity(0.15)
    ->watermarkBehind(true)
    ->download('confidential.pdf');
```

### Full Fluent API Reference

[](#full-fluent-api-reference)

```
Pdf::make()
    ->content(string|Renderable $html)
    ->header(string|Renderable $html)
    ->footer(string|Renderable $html)
    ->watermark(string|Renderable $html)
    ->paper('A4')                          // A0-A6, B4, B5, Letter, Legal, etc.
    ->orientation('portrait'|'landscape')
    ->margin('10mm')                       // Applies to all 4 sides
    ->marginTop('5mm')
    ->marginBottom('5mm')
    ->marginLeft('5mm')
    ->marginRight('5mm')
    ->headerHeight('25mm')
    ->footerHeight('15mm')
    ->headerSpacing('2mm')
    ->footerSpacing('2mm')
    ->headerOffset('0mm')
    ->footerOffset('0mm')
    ->watermarkOpacity(0.3)
    ->watermarkBehind(true)
    ->scale(1.0)                           // 0.1 to 2.0
    ->pageOffset(0)
    ->totalOffset(0)
    ->title('Invoice #1001')
    ->author('Mikail Faruq Ali')
    ->subject('Billing Invoice')
    ->keywords('billing, invoice, pdf')
    ->baseUrl(public_path('assets'))
    ->chromePath('/usr/bin/google-chrome')
    ->timeout(120)
    ->quiet()
    ->download('invoice.pdf')              // Return download Response
    ->inline('invoice.pdf')                // Return inline preview Response
    ->save('/path/to/invoice.pdf')         // Save to disk and return path
    ->toFile('/path/to/invoice.pdf')       // Alias for save()
    ->get();                               // Return binary PDF string
```

---

Artisan Commands
----------------

[](#artisan-commands)

### `php artisan pdf:install`

[](#php-artisan-pdfinstall)

Detects system OS and architecture and downloads the matching `pdf` executable from GitHub Releases (`github.com/mikailfaruqali/pdf/releases/latest`) to `storage/pdf/pdf` (or `pdf.exe` on Windows), sets executable permissions, and updates `.env`.

Options:

- `--force`: Overwrite existing binary if already present.
- `--tag=latest`: Specify release tag to download.

### `php artisan pdf:check`

[](#php-artisan-pdfcheck)

Validates that:

1. The `pdf` binary is installed, accessible, and executable.
2. Google Chrome / Chromium is installed and operational.

---

License
-------

[](#license)

The MIT License (MIT).

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance100

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

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

Unknown

Total

1

Last Release

0d ago

### Community

Maintainers

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

---

Top Contributors

[![mikailfaruqali](https://avatars.githubusercontent.com/u/77926586?v=4)](https://github.com/mikailfaruqali "mikailfaruqali (19 commits)")

---

Tags

laravelpdfchromeheadless-chromehtml-to-pdf

###  Code Quality

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/mikailfaruqali-pdf/health.svg)

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-laravel)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

80427.1M252](/packages/laravel-mcp)[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k99.8M363](/packages/laravel-horizon)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45844.8k1](/packages/pressbooks-pressbooks)[api-platform/laravel

API Platform support for Laravel

58190.1k21](/packages/api-platform-laravel)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

818355.4k3](/packages/defstudio-telegraph)

PHPackages © 2026

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