Skip to content

baiolo/RasterizeBundle

 
 

Repository files navigation

Build Status Scrutinizer Code Quality Coverage Status SensioLabsInsight

License Latest Stable Version Latest Unstable Version Total Downloads Monthly Downloads

Rasterize Bundle

A bundle to rasterize web pages with PhantomJS for Symfony2

1. Example

$response = new Response(
    $this->get('padam87_rasterize.rasterizer')->rasterize(
        $this->renderView('Bundle:Folder:template.pdf.twig')
    ),
    200, [
        'Content-Type'          => 'application/pdf',
        'Content-Disposition'   => 'attachment; filename="my.pdf"'
    ]
);

2. Installation

2.1. Composer

"padam87/rasterize-bundle": "~1.0",

2.2. AppKernel

$bundles = array(
	...
    new Padam87\RasterizeBundle\Padam87RasterizeBundle(),
);

2.3 Install assets

php app/console assets:install

3. Configuration reference

NOTE: No configuration necessary by default

padam87_rasterize:
    web_dir:              /../web # Temp dir location related to %kernel.root_dir%.
    temp_dir:             /bundles/padam87rasterize/temp # Temp dir location related to web dir. Must be in a location accessible by the web server.
    phantomjs:
        callable:             phantomjs
        options:              [] # https://github.com/ariya/phantomjs/wiki/API-Reference#wiki-command-line-options
    script:               /bundles/padam87rasterize/js/rasterize.js # Relative to web dir
    arguments: # You can define your own custom arguments. Will be added by default to every process.
        format:              pdf # Default, will always be added, even if you remove it from here.

About

A bundle to rasterize web pages with PhantomJS for Symfony2

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 97.0%
  • JavaScript 3.0%