PHPackages                             fruitcake/laravel-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. fruitcake/laravel-weasyprint

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

fruitcake/laravel-weasyprint
============================

WeasyPrint for Laravel

v0.3.1(6mo ago)2040.9k↓25.9%4MITPHPPHP ^8.1CI passing

Since Nov 15Pushed 2mo ago3 watchersCompare

[ Source](https://github.com/fruitcake/laravel-weasyprint)[ Packagist](https://packagist.org/packages/fruitcake/laravel-weasyprint)[ Fund](https://fruitcake.nl)[ GitHub Sponsors](https://github.com/barryvdh)[ RSS](/packages/fruitcake-laravel-weasyprint/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (8)Dependencies (5)Versions (15)Used By (0)

WeasyPrint PDF Wrapper for Laravel
----------------------------------

[](#weasyprint-pdf-wrapper-for-laravel)

[![Tests](https://github.com/fruitcake/laravel-weasyprint/actions/workflows/run-tests.yml/badge.svg)](https://github.com/fruitcake/laravel-weasyprint/actions/workflows/run-tests.yml)[![Packagist License](https://camo.githubusercontent.com/e60623f508586f049d48cfb8396ee411b0c9bc3be174381a1893c37462a3c1e5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e63652d4d49542d626c7565)](http://choosealicense.com/licenses/mit/)[![Latest Stable Version](https://camo.githubusercontent.com/aa50ba90f0de1e3f21ce5bc87d539165eddf4ae775f9bd472efc6cdc1c806425/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f667275697463616b652f6c61726176656c2d77656173797072696e743f6c6162656c3d537461626c65)](https://packagist.org/packages/fruitcake/laravel-weasyprint)[![Total Downloads](https://camo.githubusercontent.com/5162249150525d45eec62d239abf8b86cb458c569de3ec232980cfd4ffcdf0e0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f667275697463616b652f6c61726176656c2d77656173797072696e743f6c6162656c3d446f776e6c6f616473)](https://packagist.org/packages/fruitcake/laravel-weasyprint)[![Fruitcake](https://camo.githubusercontent.com/28d7584b52e33d7b4ffb6b1bef8b89b6e598adb45c8c0d5f80349c1c304f385e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f506f776572656425323042792d467275697463616b652d6232626333352e737667)](https://fruitcake.nl/)

This package is a ServiceProvider for WeasyPrint: .

This package is based heavily on  but uses WeasyPrint instead of WKHTMLTOPDF

### WeasyPrint Installation

[](#weasyprint-installation)

Follow the setup here: [https://doc.courtbouillon.org/weasyprint/stable/first\_steps.html#installation](https://doc.courtbouillon.org/weasyprint/stable/first_steps.html#installation)

### Testing the WeasyPrint installation

[](#testing-the-weasyprint-installation)

After installing, you should be able to run WeasyPrint from the command line / shell.

```
weasyprint https://laravel.com/docs laravel-docs.pdf
```

### Package Installation

[](#package-installation)

Require this package in your composer.json and update composer.

```
composer require fruitcake/laravel-weasyprint
```

### Configuration

[](#configuration)

You can publish the config file:

```
php artisan vendor:publish --provider="Fruitcake\WeasyPrint\WeasyPrintProvider"
```

### Usage

[](#usage)

You can create a new WeasyPrint instance and load an HTML string, file or view name. You can save it to a file, or inline (show in browser) or download.

Using the App container:

```
