kinncj/pdfcrowd-bundle

一个用于处理PDFCrowd API的Symfony2扩展包

安装: 75

依赖: 0

建议者: 0

安全性: 0

星标: 0

关注者: 2

分支: 3

类型:symfony-bundle

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

This package is auto-updated.

Last update: 2024-09-14 06:35:11 UTC


README

此扩展包作为PDFCrowd API的薄包装器,以简化与Symfony的集成。

Build Status

安装

使用composer

$ composer require kinncj/pdfcrowd-bundle

将扩展包添加到应用程序内核

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

配置

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

用法

控制器

$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

命令

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