PHPackages                             hamdallah90/easy-laravel-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. hamdallah90/easy-laravel-pdf

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

hamdallah90/easy-laravel-pdf
============================

easy-laravel-pdf: A Laravel package to generate PDF/images from views or HTML using Puppeteer in Docker for seamless integration.

2.1(1y ago)32.1k[3 PRs](https://github.com/hamdallah90/easy-laravel-pdf/pulls)MITPHPPHP ^8.2CI passing

Since Jun 10Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/hamdallah90/easy-laravel-pdf)[ Packagist](https://packagist.org/packages/hamdallah90/easy-laravel-pdf)[ Docs](https://github.com/hamdallah90/easy-laravel-pdf)[ GitHub Sponsors](https://github.com/Hamdallah90)[ RSS](/packages/hamdallah90-easy-laravel-pdf/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (8)Versions (17)Used By (0)

Easy Laravel PDF
================

[](#easy-laravel-pdf)

Overview
--------

[](#overview)

Easy Laravel PDF is a Laravel package that facilitates PDF generation within Laravel applications. This package utilizes a Node.js service, `node-html-to-pdf`, which can be run locally or via Docker to convert HTML to PDF.

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

[](#installation)

### Prerequisites

[](#prerequisites)

- PHP 7.3 or higher
- Laravel 6.0 or higher
- Composer
- Node.js and npm (optional, if running the service locally without Docker)
- Docker (optional, for using Docker container)

### Installing the Package

[](#installing-the-package)

1. **Add the Package via Composer:**

    ```
    composer require hamdallah90/easy-laravel-pdf
    ```
2. **Publish Configuration:**Laravel's package discovery will automatically register the service provider. To publish the package configuration, run:

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

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

[](#configuration)

Edit the published configuration file in `config/easy-laravel-pdf.php` to adjust settings like default PDF options.

Using the Package
-----------------

[](#using-the-package)

`EasyLaravelPdf` offers a variety of methods to generate PDF files. Here's how to use them in your Laravel applications:

### Load and Render a View

[](#load-and-render-a-view)

```
use Jouda\EasyLaravelPdf\Facades\EasyLaravelPdf;

$pdf = EasyLaravelPdf::loadView('view.name', ['dataKey' => 'dataValue']);
return $pdf->stream('example.pdf');
```

### Load HTML Content Directly

[](#load-html-content-directly)

To load raw HTML content into the PDF generator:

```
use Jouda\EasyLaravelPdf\Facades\EasyLaravelPdf;

EasyLaravelPdf::loadHtml('Test PDF')->save('/path/to/file.pdf');
```

### URL To PDF

[](#url-to-pdf)

To Print url insted of send html or view:

```
use Jouda\EasyLaravelPdf\Facades\EasyLaravelPdf;

EasyLaravelPdf::setUrl('http://google.com')->save('/path/to/file.pdf');
```

### Get the PDF as an UploadedFile

[](#get-the-pdf-as-an-uploadedfile)

To get the PDF as an UploadedFile, which can be useful for testing or further manipulation:

```
use Jouda\EasyLaravelPdf\Facades\EasyLaravelPdf;

$file = EasyLaravelPdf::loadHtml('Test PDF')->getFile();
$file->store('save-to-s3-or-local-path')
```

### Stream the PDF Directly to the Browser

[](#stream-the-pdf-directly-to-the-browser)

To stream the PDF directly to the browser, which is useful for inline viewing:

```
use Jouda\EasyLaravelPdf\Facades\EasyLaravelPdf;

return EasyLaravelPdf::loadHtml('Test PDF')->stream('optional-filename.pdf');  // Streams the PDF; if a filename is provided, it will be used
```

Configuration and Customization
-------------------------------

[](#configuration-and-customization)

You can configure puppeteer options and launch arguments for more control over the PDF generation:

```
use Jouda\EasyLaravelPdf\Facades\EasyLaravelPdf;
$pdf = EasyLaravelPdf::setOptions(['format' => 'A4']);
$pdf->setPuppeteerLunchArgs(['--no-sandbox', '--disable-setuid-sandbox']);
$pdf->loadHtml('Customized PDF');
$pdf->save('path/to/your/customized.pdf');
```

Node HTML to PDF Service
------------------------

[](#node-html-to-pdf-service)

This service is essential for PDF generation and can be run locally or in a Docker container.

### Running Locally

[](#running-locally)

1. Navigate to the `node-html-to-pdf` directory.
2. Install dependencies: ```
    npm install
    ```
3. Start the server: ```
    npm start
    ```

### Running with Docker

[](#running-with-docker)

1. **Using the Dockerfile:**Build the Docker image using the provided Dockerfile:

    ```
    cd node-html-to-pdf
    docker build -t your-username/html-to-pdf .
    docker run -p 3000:3000 your-username/html-to-pdf
    ```
2. **Using the Pre-built Image:**Alternatively, you can use a pre-built Docker image available on Docker Hub:

    ```
    docker pull hamdallah/html-to-pdf
    docker run -p 3000:3000 hamdallah/html-to-pdf
    ```

Support
-------

[](#support)

For issues, feature requests, or contributions, please use the GitHub issues section for this repository.

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance70

Regular maintenance activity

Popularity21

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 82.6% 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 ~18 days

Recently: every ~6 days

Total

14

Last Release

471d ago

Major Versions

0.3 → 1.02024-06-10

1.8 → 2.02025-01-07

### Community

Maintainers

![](https://www.gravatar.com/avatar/368f4bba76734984f3c9fae12139cddea8e0f7d5dfaa35ee785e2903f66fa374?d=identicon)[hamdallah90](/maintainers/hamdallah90)

---

Top Contributors

[![hamdallah90](https://avatars.githubusercontent.com/u/16318175?v=4)](https://github.com/hamdallah90 "hamdallah90 (38 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (4 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (4 commits)")

---

Tags

laravelHamdallaheasy-laravel-pdf

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/hamdallah90-easy-laravel-pdf/health.svg)

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

###  Alternatives

[spatie/laravel-pdf

Create PDFs in Laravel apps

9963.4M12](/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)
