PHPackages                             tungltdev/laravel-html-to-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. tungltdev/laravel-html-to-pdf

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

tungltdev/laravel-html-to-pdf
=============================

Convert a html string to a pdf string

05PHP

Since May 19Pushed 1y ago1 watchersCompare

[ Source](https://github.com/tungltdev/laravel-html-to-pdf)[ Packagist](https://packagist.org/packages/tungltdev/laravel-html-to-pdf)[ RSS](/packages/tungltdev-laravel-html-to-pdf/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Installation:

```
$ composer require tungltdev/laravel-html-to-pdf
```

Features:

- Convert an html string to a pdf string using wkhtmltopdf
- Does not use temporary files

Basic usage:

```
use \Tungltdev\LARAVEL\HtmlToPdf;

try{

    $pdf = new HtmlToPdf('Hi!', '/usr/local/bin/wkhtmltopdf');

    header('Content-Type: application/pdf');

    echo $pdf->generate();

}
catch(Exception $e){
    echo $e->getMessage();
}
```

Advanced usage:

```
use \Tungltdev\LARAVEL\HtmlToPdf;

try{

    //Get your html string
    $html = file_get_contents('demo.html');

    // Path to wkhtmltopdf
    $pathToWkhtmltopdf = '/usr/local/bin/wkhtmltopdf';

    // Initialise
    $pdf = new HtmlToPdf($html, $pathToWkhtmltopdf);

    // Add a command before the wkhtmltopdf command
    $pdf->addBeforeCommand('unset DYLD_LIBRARY_PATH');

    // Add wkhtmltopdf parameters, second parameter is optional. See: http://wkhtmltopdf.org/usage/wkhtmltopdf.txt
    $pdf->setParam('grayscale');
    $pdf->setParam('orientation', 'landscape');

    // Execute
    $pdfString = $pdf->generate();

    // Show the generated pdf
    header('Content-Type: application/pdf');
    die($pdfString);

}
catch(Exception $e){
    echo $e->getMessage();
}
```

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity15

Early-stage or recently created project

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/31556693?v=4)[Lê Thanh Tùng](/maintainers/tungltdev)[@tungltdev](https://github.com/tungltdev)

### Embed Badge

![Health badge](/badges/tungltdev-laravel-html-to-pdf/health.svg)

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

###  Alternatives

[tarfin-labs/easy-pdf

Makes pdf processing easy.

1719.9k](/packages/tarfin-labs-easy-pdf)

PHPackages © 2026

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