amp/pdfcrowd-bundle

This package is abandoned and no longer maintained. No replacement package was suggested.

A Symfony2 bundle for working with the PDFCrowd API

dev-master 2012-08-29 23:56 UTC

This package is not auto-updated.

Last update: 2022-10-29 04:14:56 UTC


README

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

Build Status

Installation

Using composer

{
    "repositories": [
        {
            "type": "package",
            "package": {
                "name": "pdfcrowd/pdfcrowd-php",
                "version": "2.5",
                "dist": {
                    "url": "http://pdfcrowd.com/static/clients/php/pdfcrowd-2.5-php.zip",
                    "type": "zip"
                },
                "autoload": {
                    "files": ["pdfcrowd.php"]
                }
            }
        }
    ],
    "require": {
        "amp/pdfcrowd-bundle": "dev-master"
    }
}

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