With this bundle you can easily use DOMPDF to generate pdf documents from anywhere in Symfony2
PHP HTML JavaScript CSS
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
DependencyInjection
DomPDF
Resources
Tests/Functional intial import Dec 3, 2012
Wrapper
hooks Better mac support for echo Jun 12, 2012
.gitignore
.travis.yml
CONTRIBUTORS.md
LICENCE
README.md
SlikDompdfBundle.php
composer.json
composer.lock
dompdf_config.custom.inc.php.dist added option to use customisable dompdf config for symfony2 Dec 20, 2012
dompdf_config.inc.php.dist
phpdoc.dist.xml
phpunit.xml.dist fix naming convention for bundle itself Jun 10, 2012

README.md

What is DomPDFBundle?

This bundle provides a wrapper for using DomPDF inside Symfony2.

Installation

When using composer add the following to your composer.json

// composer.json
{
    //...

    "require": {
        //...
        "slik/dompdf-bundle" : "dev-master"
    }

    //...
}

and run php composer.phar update slik/dompdf-bundle.

Next add the following to your appkernel:

    // in AppKernel::registerBundles()
    $bundles = array(
        // Dependencies
        new Slik\DompdfBundle\SlikDompdfBundle();
    );

Custom configuration

Copy the dompdf_config..inc.php.dist files to dompdf_config..inc.php to your /app directory and follow the dompdf usage docs.

Usage

Whenever you need to turn something into a pdf just use this anywhere in your controller:

    // Set some html and get the service
    $html = '<h1>Sample html</h1>';
    $dompdf = $this->get('slik_dompdf');

    // Generate the pdf
    $dompdf->getpdf($html);

    // Either stream the pdf to the browser
    $dompdf->stream("myfile.pdf");

    // Or get the output to handle it yourself
    $pdfoutput = $dompdf->output();