falgun / phantom-bundle
Generate pdf using phantomjs
Installs: 68
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.3.2
Requires (Dev)
- symfony/framework-bundle: 2.4.1
This package is not auto-updated.
Last update: 2024-05-25 12:42:03 UTC
README
A symfony 2 bundle to generate pdf using phantomjs.
Installation
Step 1: You need to download Phantomjs in your machine to use the bundle
Install phantomjs 1.9.2 from this link http://phantomjs.org/download.html
Step 2: Download FalgunPhantomBundle
Add FalgunPhantomBundle in your composer.json as below:
"falgun/phantom-bundle": "dev-master"
Update/install with this command:
php composer.phar update "falgun/phantom-bundle"
Step 2: Enable the bundle
Register the bundle
public function registerBundles() { $bundles = array( ... new Falgun\Bundle\PhantomBundle\FalgunPhantomBundle(), );
Step 3: Activate the main configs
# app/config/config.yml
falgun_phantom:
config:
format: 'A3'
margin: '.5cm'
zoom: 1
orientation: 'portrait'
rendering_time: 1000
viewport_width: 800
viewport_height: 800
rendering_timeout: 90000
phantomjs: '/usr/local/bin/phantomjs'
How to use ?
public function indexAction() { $falgun_pdf = $this->get('falgun_pdf'); $result = $falgun_pdf->to_pdf("http://www.google.com"); }