PHPackages                             betterbrief/silverstripe-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. betterbrief/silverstripe-pdf

AbandonedArchivedSilverstripe-module[PDF &amp; Document Generation](/categories/documents)

betterbrief/silverstripe-pdf
============================

Provide PDF renders of your webpages or objects using SSViewer, Snappy and wkhtmltopdf

v1.0.0(8y ago)116.5k3[1 issues](https://github.com/BetterBrief/silverstripe-pdf/issues)BSD-3-ClausePHPPHP &gt;=5.3.2

Since Feb 9Pushed 8y ago2 watchersCompare

[ Source](https://github.com/BetterBrief/silverstripe-pdf)[ Packagist](https://packagist.org/packages/betterbrief/silverstripe-pdf)[ RSS](/packages/betterbrief-silverstripe-pdf/feed)WikiDiscussions master Synced today

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

SilverStripe PDF Extension
==========================

[](#silverstripe-pdf-extension)

Have you ever wanted to deliver your SilverStripe website's content in a slow and bloated format? If you have, this module fulfils your needs!

### Install

[](#install)

1. Use [Composer](http://getcomposer.org): `composer require betterbrief/silverstripe-pdf`
2. Install the correct version of `wkhtmltopdf`...

- The version of the binary you use is dependent on your architecture. To find out the architecture your server is running, type `arch` in your terminal window. With the [development environment](https://github.com/BetterBrief/vagrant-skeleton), we use **amd64**.

### Set up

[](#set-up)

1. Once you have got the module from composer, you will need to get the wkhtmltopdf binary and then configure PDFExtension to point to it. The composer suggestions give you your options.
2. Add `PDFExtension` to the objects you wish to render to PDF.

#### Config example

[](#config-example)

```
PDFExtension:
  wkhtmltopdf_binary: '/vagrant/www/vendor/bin/wkhtmltopdf-amd64'
MyDataObject:
  extensions:
    - PDFExtension
```

### Use it

[](#use-it)

1. Author your template file called `MyDataObject_pdf.ss` in a suitable directory within your templates folder. Note that you can override this name if you wish to do so.
2. If this is a standalone file, you will need to include the base tag so assets are rendered correctly. In your template: ``
3. Congratulations, you can now call `MyDataObject->generatePDF()` and get your PDF data.
    - If you wish to send the output to the browser, you'll need to set your response body to `generatePDF()`'s response, use `SS_HTTPResponse->addHeader('Content-Type', 'application/pdf')`.
    - To force a download, `SS_HTTPResponse->addHeader('Content-Disposition', 'attachment')`

### Configuration

[](#configuration)

You can configure generation on a call-by-call basis by modifying the `PDFExtension->generatePDF()` parameters.

- Use the `$userOptions` parameter to pass in Snappy / wkhtmltopdf options. [Here's the full list.](http://wkhtmltopdf.org/usage/wkhtmltopdf.txt)
- Use `$variables` to pass in your standard SSViewer template variables. Note that by default `enable-javascript` is turned off.

Config OptionDefaultHow to use`wkhtmltopdf_binary``null`Set this to the absolute location of wkhtmltopdf, otherwise nothing will work.`render_host``http://localhost/`As the page is generated on the server, the public facing host will typically not be accessible, and instead be localhost. You may want to change this when deploying to distributed environments.### Things to note

[](#things-to-note)

- Pages are generated in the context of the current session. So if the requesting user is a logged in administrator, the PDF will be generated with that member's state and permission level.
- It is advisable to get the following packages to avoid graphic / font issues with rendering: fontconfig, libXrender, libXext and urw-fonts. You can get these on CentOS with `yum install fontconfig libXrender libXext urw-fonts`

### Requirements

[](#requirements)

- [wkhtmltopdf](http://wkhtmltopdf.org/) will take the HTML you generate and create a PDF document out of it using Webkit as the rendering engine.
- [Knp's Snappy](https://github.com/KnpLabs/snappy/tree/0.2.0) provides the bridge functionality between wkhtmltopdf and PHP

### Licensing

[](#licensing)

- silverstripe-pdf's code is made available to you under the BSD license (see [LICENSE](LICENSE))
- As of 2014-05-30, Knp Snappy is under the MIT license
- As of 2014-05-30, wkhtmltopdf is under the LGPL license.

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% 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

2

Last Release

3065d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/168688?v=4)[Will Morgan](/maintainers/willmorgan)[@willmorgan](https://github.com/willmorgan)

---

Top Contributors

[![willmorgan](https://avatars.githubusercontent.com/u/168688?v=4)](https://github.com/willmorgan "willmorgan (6 commits)")[![dhensby](https://avatars.githubusercontent.com/u/563596?v=4)](https://github.com/dhensby "dhensby (3 commits)")

---

Tags

pdfsilverstripe

### Embed Badge

![Health badge](/badges/betterbrief-silverstripe-pdf/health.svg)

```
[![Health](https://phpackages.com/badges/betterbrief-silverstripe-pdf/health.svg)](https://phpackages.com/packages/betterbrief-silverstripe-pdf)
```

###  Alternatives

[barryvdh/laravel-snappy

Snappy PDF/Image for Laravel

2.8k26.5M51](/packages/barryvdh-laravel-snappy)[silverstripe/textextraction

Text Extraction API for SilverStripe CMS (mostly used with 'fulltextsearch' module)

10187.2k7](/packages/silverstripe-textextraction)[endroid/pdf

Endroid PDF

3546.2k](/packages/endroid-pdf)[symbiote/silverstripe-pdfrendition

A module that makes use of the Flying Saucer XHTML renderer project to create PDFs from XHTML pages.

175.1k](/packages/symbiote-silverstripe-pdfrendition)[siphoc/pdf-bundle

Siphoc PDF Bundle for Symfony2

1542.6k](/packages/siphoc-pdf-bundle)[enupal/snapshot

PDF or Image generation from a Url or HTML page

1138.0k](/packages/enupal-snapshot)

PHPackages © 2026

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