AmpPDFCrowdBundle
This bundle act as a thin wrapper over the PDFCrowd API to ease integration with Symfony., (*1)
, (*2)
Installation
Using composer
$ composer require kinncj/pdfcrowd-bundle
Add the bundle to your application kernel
``` php
// File: app/AppKernel.php
public function registerBundles()
{
return array(
// ...
new Amp\PDFCrowdBundle\AmpPDFCrowdBundle(),
// ...
);
}, (*3)
## Configuration
``` yaml
amp_pdf_crowd:
username: your-username
apikey: the-api-key
Usage
Controller
``` php
$pdfCrowd = $this->get('amp_pdf_crowd.api');
$url = $this->generateUrl('route_name', array(), true);, (*4)
$pdfData = $pdfCrowd->convertURI($url);
$fileName = $this->container->getParameter('kernel.root_dir') . '/../web/pdfs/example.pdf';, (*5)
file_put_contents($fileName, $pdfData); // Make sure this directory is writable, (*6)
### Command
``` bash
$ app/console pdfcrowd:convert https://github.com/hubertperron/AmpPDFCrowdBundle web/pdfs/example.pdf