kinncj/pdfcrowd-bundle

A Symfony2 bundle for working with the PDFCrowd API

Installs: 75

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 3

Type:symfony-bundle

v0.1.0 2016-02-08 16:39 UTC

This package is auto-updated.

Last update: 2024-12-14 07:15:28 UTC


README

This bundle act as a thin wrapper over the PDFCrowd API to ease integration with Symfony.

Build Status

Installation

Using composer

$ composer require kinncj/pdfcrowd-bundle

Add the bundle to your application kernel

// File: app/AppKernel.php
public function registerBundles()
{
    return array(
        // ...
        new Amp\PDFCrowdBundle\AmpPDFCrowdBundle(),
        // ...
    );
}

Configuration

amp_pdf_crowd:
    username: your-username
    apikey: the-api-key

Usage

Controller

$pdfCrowd = $this->get('amp_pdf_crowd.api');
$url = $this->generateUrl('route_name', array(), true);

$pdfData = $pdfCrowd->convertURI($url);
$fileName = $this->container->getParameter('kernel.root_dir') . '/../web/pdfs/example.pdf';

file_put_contents($fileName, $pdfData); // Make sure this directory is writable

Command

 $ app/console pdfcrowd:convert https://github.com/hubertperron/AmpPDFCrowdBundle web/pdfs/example.pdf