kwizer15/pdf-bundle
Composer 安装命令:
composer require kwizer15/pdf-bundle
包简介
PDF library for Symfony2
关键字:
README 文档
README
Installation
- Install KwizerPdfBundle
- Enable the bundle
Install KwizerPdfBundle
Add the following dependency to your composer.json file:
{
"require": {
"kwizer15/pdf-bundle": "1.0.*"
}
}
Update vendors
$ php composer.phar update
Enable the bundle
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Kwizer\PdfBundle\KwizerPdfBundle(), ); }
Using the bundle
Hello World
The document
<?php // src/Acme/DemoBundle/PdfDocument/MyPdf.php namespace Acme\DemoBundle\PdfDocument; class MyDocument extends \Kwizer\PdfBundle\Core\AbstractPdfDocument { public function buildContent() { $this->builder->cell('Hello World !!!'); } }
Controller
<?php // src/Acme/DemoBundle/Controller/MyController.php ... use Symfony\Component\HttpFoundation\Response; use Acme\DemoBundle\PdfDocument\MyDocument; class MyController extends Controller { public function myAction() { $response = new Response(); $response->headers->set('Content-Type', 'application/pdf'); $response->headers->set('Content-Disposition', 'inline; filename=my.pdf'); $pdf = $this->get('kwizer.pdf.factory')->createPdf(new MyDocument()); $response->setContent($pdf); return $response; } }
统计信息
- 总下载量: 21
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPLv2
- 更新时间: 2014-04-07