PHPackages                             jaxwilko/php-chrome-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. jaxwilko/php-chrome-pdf

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

jaxwilko/php-chrome-pdf
=======================

A package to leverage Chrome as a PDF renderer for PHP

v0.1.2(3y ago)3131MITPHP

Since Jul 10Pushed 3y ago2 watchersCompare

[ Source](https://github.com/jaxwilko/php-chrome-pdf)[ Packagist](https://packagist.org/packages/jaxwilko/php-chrome-pdf)[ RSS](/packages/jaxwilko-php-chrome-pdf/feed)WikiDiscussions main Synced 2w ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

PHP Chrome PDF
==============

[](#php-chrome-pdf)

This package offers an interface for generating PDFs using Chrome.

> Notice: This package requires google-chrome/chromium to be installed and available to the php user

### Install

[](#install)

```
composer require jaxwilko/php-chrome-pdf
```

### Usage

[](#usage)

For basic usage, you can use the `make()` helper method:

```
$pdf = \ChromePdf\ChromePdf::make($content);
// or printing to file
\ChromePdf\ChromePdf::make($content, '/path/to/out.pdf');
```

`ChromePdf` supports multiple input types, these include:

- `url` for rendering a website url (i.e. `https://example.com`)
- `file` for rendering a file
- `text` for rendering text content

```
use ChromePdf\ChromePdf;

$chromePdf = new ChromePdf();

// Render text content (this is the default option)
$chromePdf->setInput($content);
$chromePdf->setInput($content, ChromePdf::INPUT_TEXT);

// Render a url
$chromePdf->setInput('https://example.com', ChromePdf::INPUT_URL);

// Render a file
$chromePdf->setInput('/path/to/example.html', ChromePdf::INPUT_FILE);

// Print PDF to file
$chromePdf->print(__DIR__ . '/example.pdf');

// Print PDF and get as binary
$pdf = $chromePdf->print();
```

If you need to customise the chrome flags, you can use the following methods:

```
// Set a single flag
$chromePdf->setFlag('--example-flag');

// Set multiple flags
$chromePdf->setFlag([
    '--example-flag-a',
    '--example-flag-b',
]);

// Replace all flags
$chromePdf->setFlags([
    '--example-flag-a',
    '--example-flag-b',
    '--example-flag-c'
]);

// You can also retrieve flag via
$flags = $chromePdf->getFlags();

// Removing a flag
$chromePdf->clearFlag('--example-flag');
```

### Chrome flags

[](#chrome-flags)

The following are some useful flags which may help.

- `--virtual-time-budget=1000` This will make sure remote assets (e.g. fonts) finish loading before printing the page. If set the system waits the specified number of virtual milliseconds before deeming the page to be ready. For determinism virtual time does not advance while there are pending network fetches (i.e no timers will fire). Once all network fetches have completed, timers fire and if the system runs out of virtual time is fastforwarded so the next timer fires immediately, until the specified virtual time budget is exhausted
- `--run-all-compositor-stages-before-draw` Effectively disables pipelining of compositor frame production stages by waiting for each stage to finish before completing a frame.

For more see [Peter Beverloo's very helpful page](https://peter.sh/experiments/chromium-command-line-switches/).

###  Health Score

20

—

LowBetter than 12% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 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

Every ~0 days

Total

3

Last Release

1135d ago

### Community

Maintainers

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

---

Top Contributors

[![jaxwilko](https://avatars.githubusercontent.com/u/31214002?v=4)](https://github.com/jaxwilko "jaxwilko (6 commits)")

### Embed Badge

![Health badge](/badges/jaxwilko-php-chrome-pdf/health.svg)

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

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k39.6k](/packages/matomo-matomo)[spatie/browsershot

Convert a webpage to an image or pdf using headless Chrome

5.2k38.5M189](/packages/spatie-browsershot)[tempest/framework

The PHP framework that gets out of your way.

2.3k37.6k21](/packages/tempest-framework)[illuminate/console

The Illuminate Console package.

13046.6M7.4k](/packages/illuminate-console)[pontedilana/php-weasyprint

PHP library allowing PDF generation from an url or a html page. Wrapper for Kozea/WeasyPrint.

791.3M20](/packages/pontedilana-php-weasyprint)[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)

PHPackages © 2026

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