kinncj / pdfcrowd-bundle
一个用于处理PDFCrowd API的Symfony2扩展包
v0.1.0
2016-02-08 16:39 UTC
Requires
- radweb/pdfcrowd-php: dev-master
- symfony/symfony: 2.*
This package is auto-updated.
Last update: 2024-09-14 06:35:11 UTC
README
此扩展包作为PDFCrowd API的薄包装器,以简化与Symfony的集成。
安装
使用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