PHPackages                             andrew72ru/web-to-print - 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. andrew72ru/web-to-print

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

andrew72ru/web-to-print
=======================

The package for generating PDF pages from HTML with headless Chrome and Chrome-driver

v1.0.0(3y ago)13MITPHPPHP &gt;=8.0

Since Nov 20Pushed 3y ago1 watchersCompare

[ Source](https://github.com/andrew72ru/web-to-print)[ Packagist](https://packagist.org/packages/andrew72ru/web-to-print)[ RSS](/packages/andrew72ru-web-to-print/feed)WikiDiscussions main Synced today

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

Web to Print
============

[](#web-to-print)

The package for generating PDF pages from HTML with headless Chrome and Chrome driver.

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

[](#requirements)

This package requires PHP &gt;= 8.0 with `ctype` and `iconv` extensions. You must also have installed Chrome (chromium) and `cromedriver` executables in your working environment.

Usage
-----

[](#usage)

First, create an instance of the Chrome Driver runner:

```
$logger = new \Psr\Log\NullLogger(); // Choose your Psr\Log\LoggerInterface implementation
$runner = new \Andrew72ru\Web2print\DriverRunner($logger, '/path/to/chromedriver');
```

After that, you can call the `PrintToPdf` class:

```
$printer = new \Andrew72ru\Web2print\PrintToPdf($runner, $logger);
$result = $printer('https://google.com', asBas64: true); // You can get Base64 or binary string
\file_put_contents('google.pdf', \base64_decode($result));
```

As a result, you will have a 'google.pdf' file in your working directory.

Default options
---------------

[](#default-options)

The `PrintToPdf` class has a set of default options to run the Chrome and the print command.

### Chrome options

[](#chrome-options)

```
$defaultArguments = ['--headless', '--run-all-compositor-stages-before-draw'];
```

### Print options

[](#print-options)

```
$defaultParams = [
    'displayHeaderFooter' => false,
    'printBackground' => true,
    'marginTop' => 0,
    'marginBottom' => 0,
    'marginLeft' => 0,
    'marginRight' => 0,
];
```

See references in [Chrome manual](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-printToPDF).

Testing
-------

[](#testing)

Before tests, you must put the `chromedriver` executable into the project root.

Run tests:

```
vendor/bin/phpunit
```

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

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

1322d ago

### Community

Maintainers

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

---

Top Contributors

[![andrew72ru](https://avatars.githubusercontent.com/u/567649?v=4)](https://github.com/andrew72ru "andrew72ru (10 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/andrew72ru-web-to-print/health.svg)

```
[![Health](https://phpackages.com/badges/andrew72ru-web-to-print/health.svg)](https://phpackages.com/packages/andrew72ru-web-to-print)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.8k543.8M20.1k](/packages/laravel-framework)[kimai/kimai

Kimai - Time Tracking

4.8k9.0k1](/packages/kimai-kimai)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M574](/packages/shopware-core)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M203](/packages/sulu-sulu)

PHPackages © 2026

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