PHPackages                             pontedilana/php-weasyprint - 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. pontedilana/php-weasyprint

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

pontedilana/php-weasyprint
==========================

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

2.7.0(2mo ago)791.3M↓28.3%13[1 issues](https://github.com/pontedilana/php-weasyprint/issues)6MITPHPPHP 7.4.\* || 8.0.\* || 8.1.\* || 8.2.\* || 8.3.\* || 8.4.\* || 8.5.\*CI passing

Since Jul 16Pushed 2mo ago4 watchersCompare

[ Source](https://github.com/pontedilana/php-weasyprint)[ Packagist](https://packagist.org/packages/pontedilana/php-weasyprint)[ GitHub Sponsors](https://github.com/endelwar)[ Fund](https://ko-fi.com/endelwar)[ RSS](/packages/pontedilana-php-weasyprint/feed)WikiDiscussions develop Synced 2w ago

READMEChangelog (10)Dependencies (35)Versions (27)Used By (6)Security (4)

PhpWeasyPrint
=============

[](#phpweasyprint)

PhpWeasyPrint is a PHP library allowing PDF generation from a URL or an HTML page. It's a wrapper for [WeasyPrint](https://weasyprint.org/), a smart solution helping web developers to create PDF documents, available everywhere Python runs.

You will have to download and install WeasyPrint to use PhpWeasyPrint (version 60 or greater is required).

This library is massively inspired by [KnpLabs/snappy](https://github.com/KnpLabs/snappy) and aims to be a drop-in replacement: its `GeneratorInterface` mirrors Snappy's method contract (same method names and behaviour), though it lives in its own namespace and is strictly typed (`string`-only input, declared return types). See "[Differences with Snappy](#differences-with-snappy)" section to see how the two differs

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

[](#requirements)

- PHP 8.3, 8.4 or 8.5
- WeasyPrint 60 or greater

Installation using [Composer](https://getcomposer.org/)
-------------------------------------------------------

[](#installation-using-composer)

```
$ composer require pontedilana/php-weasyprint
```

Usage
-----

[](#usage)

### Initialization

[](#initialization)

```
