PHPackages                             dlin/snappy-bundle - 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. dlin/snappy-bundle

ActiveSymfony-bundle[PDF &amp; Document Generation](/categories/documents)

dlin/snappy-bundle
==================

Symfony Bundle for Snappy ( wkhtmltopdf )

v0.9.3(12y ago)1135MITPHPPHP &gt;=5.3.8

Since Sep 30Pushed 12y ago1 watchersCompare

[ Source](https://github.com/dlin-me/snappy)[ Packagist](https://packagist.org/packages/dlin/snappy-bundle)[ Docs](http://dlin.me)[ RSS](/packages/dlin-snappy-bundle/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (4)Dependencies (5)Versions (5)Used By (0)

Dlin Symfony Snappy Bundle
==========================

[](#dlin-symfony-snappy-bundle)

Dlin Symfony Snappy Bundle is wrapper bundle for [Snapy](https://github.com/KnpLabs/snappy) :

> Snappy is a PHP5 library allowing thumbnail, snapshot or PDF generation from a url &gt;or a html page. It uses the excellent webkit-based wkhtmltopdf and wkhtmltoimage &gt;available on OSX, linux, windows.

Dlin Symfony Snappy Bundle provides a configurable service to work with PDF files

---

Installation
------------

[](#installation)

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

NOTE: Unfortunately, Composer does not support repositories in nested dependencies, we have to include dependencies and repositories in the root composer.json.

Add to your `composer.json`:

```
json
{
    "require" :  {
        ....
        "dlin/snappy-bundle": "dev-master",
        "google/wkhtmltopdf-amd64": "0.11.0-RC1",
        "google/wkhtmltopdf-i386": "0.11.0-RC1",
    },

    ....

    "repositories": [
        {
            "type": "package",
            "package": {
                "name": "google/wkhtmltopdf-amd64",
                "version": "0.11.0-RC1",
                "dist": {
                    "url": "http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.11.0_rc1-static-amd64.tar.bz2",
                    "type": "tar"
                }
            }
        },
        {
            "type": "package",
            "package": {
                "name": "google/wkhtmltopdf-i386",
                "version": "0.11.0-RC1",
                "dist": {
                    "url": "http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.11.0_rc1-static-i386.tar.bz2",
                    "type": "tar"
                }
            }
        }
    ]
}

```

Enable the bundle in you AppKernel.php

```
public function registerBundles()
{
    $bundles = array(
    ...
    new Dlin\Bundle\SnappyBundle\DlinSnappyBundle(),
    ...
}

```

Configuration
-------------

[](#configuration)

You can specify the installation location of wkhtmltopdf

```
#app/config/config.yml

dlin_snappy:
    pdf_service:
        wkhtmltopdf: /Applications/wkhtmltopdf.app/Contents/MacOS/wkhtmltopdf

```

For most OS, this bundle will try to download and install the wkhtmltopdf binary itself. No configuration is required unless you want to use a different wkhtmltopdf binary. For Mac servers, one will have to download the DMG file and install it. The above configuration is required.

Usage
-----

[](#usage)

Geting the service in a controller

```
$pdf =  $this->get('dlin.pdf_service');

```

Getting the service in a ContainerAwareService

```
$pdf = $this->container->get('dlin.pdf_service');

```

Using the method "createPdfFromHtml"

```
#Pdf will be created (replace if already exist) as file '/tmp/test.pdf'
$pdf->createPdfFromHtml('hello', '/tmp/test.pdf');

```

Using the method "createPdfFromUrl"

```
#Pdf will be created (replace if already exist) as file '/tmp/test.pdf'
$pdf->createPdfFromUrl('google.com', '/tmp/test.pdf');

```

Download to browser (HTTP headers will be set and script terminates)

```
$pdf->sendHtmlAsPdf('hello', 'downloadFileName.pdf');
#or
$pdf->sendUrlAsPdf('google.com', 'downloadFileName.pdf');

```

Show PDF inline in browser (HTTP headers will be set and script terminates)

```
$pdf->sendHtmlAsPdf('hello', 'downloadFileName.pdf', true);
#or
$pdf->sendUrlAsPdf('google.com', 'downloadFileName.pdf', true);

```

Notes
-----

[](#notes)

- MAMP user couldl have problem using wkhtmltopdf. Please solve the problem [here](http://oneqonea.blogspot.in/2012/04/why-does-wkhtmltopdf-work-via-terminal.html)
- Mac OSX requires its own wkhtmltopdf binnary. You can download it [here](https://code.google.com/p/wkhtmltopdf/downloads/list).
- On your \*nix server, you might need to install a library (sudo apt-get install libxrender1)

License
-------

[](#license)

MIT

*Free Software, Yeah!*

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

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

Every ~38 days

Total

4

Last Release

4543d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1905715?v=4)[David Lin](/maintainers/dlin-me)[@dlin-me](https://github.com/dlin-me)

---

Top Contributors

[![dlin-me](https://avatars.githubusercontent.com/u/1905715?v=4)](https://github.com/dlin-me "dlin-me (2 commits)")

---

Tags

symfonypdfwkhtmltopdf

### Embed Badge

![Health badge](/badges/dlin-snappy-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/dlin-snappy-bundle/health.svg)](https://phpackages.com/packages/dlin-snappy-bundle)
```

###  Alternatives

[barryvdh/laravel-snappy

Snappy PDF/Image for Laravel

2.8k26.5M51](/packages/barryvdh-laravel-snappy)[sensiolabs/gotenberg-bundle

A Symfony bundle that provides seamless integration with Gotenberg for generating PDFs and screenshots from various sources (HTML, Markdown, Office documents, URLs) with a clean, builder-based API.

231368.6k2](/packages/sensiolabs-gotenberg-bundle)[nitmedia/wkhtml2pdf

Html 2 Pdf - using wkhtml2pdf, work on 32bit and 64 bit linux + MacOS

119306.5k1](/packages/nitmedia-wkhtml2pdf)[mvlabs/mvlabs-snappy

MvlabsSnappy is a Zend Framework and Laminas module that allow easy to thumbnail, snapshot or PDF generation from a url or a html page using Snappy PHP wrapper for the wkhtmltopdf/wkhtmltoimage conversion utility.

2454.0k](/packages/mvlabs-mvlabs-snappy)

PHPackages © 2026

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