SalvaPdfJsBundle
, (*1)
This bundle provides a simple integration of the "PDF.JS library" from mozilla into Symfony2., (*2)
Installation
1) Download SalvaPdfJsBundle
Using the vendors script, (*3)
Add the following lines to the deps
file at the root of your project file:, (*4)
[SalvaPdfJsBundle]
git=http://github.com/nibsirahsieu/SalvaPdfJsBundle.git
target=bundles/Salva/PdfJsBundle
Next, update your vendors by running:, (*5)
``` bash
$ ./bin/vendors install, (*6)
**Using composer**
Tell composer to download the bundle by running the command:
``` bash
$ php composer.phar require salva/pdfjs-bundle:1.0.*@dev
Add the following entry to your autoloader:, (*7)
``` php
<?php
// app/autoload.php, (*8)
$loader->registerNamespaces(array(
// ..., (*9)
'Salva' => __DIR__.'/../vendor/bundles',
));, (*10)
### 3) Enable the bundle
Finally, enable the bundle in the kernel:
``` php
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Salva\PdfJsBundle\SalvaPdfJsBundle(),
);
}
Basic Usage
``` php
<?php, (*11)
$file = '/uploads/yourpdf.pdf'; //relative to your website root directory, (*12)
return $this->get('salva_pdf_js.controller')->renderPdf($file);, (*13)
```, (*14)