acucchieri/tcpdf-bundle
Composer 安装命令:
composer require acucchieri/tcpdf-bundle
包简介
Integration of the tcpdf library with Symfony
README 文档
README
The ACTcpdfBundle integrates the TCPDF PHP library with Symfony. This means easy-to-implement and easy-to-ouptput PDF documents in your Symfony application.
Installation
Step 1: Download the Bundle
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
composer require acucchieri/tcpdf-bundle
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
Step 2: Enable the Bundle
Then, enable the bundle by adding the following line in the app/AppKernel.php file of your project:
// app/AppKernel.php class AppKernel extends Kernel { public function registerBundles() { $bundles = [ // ... new AC\TcpdfBundle\ACTcpdfBundle(), ]; // ... } }
Usage
Use AC\TcpdfBundle\Pdf\PdfBuider to create your PDF document. This class extends TCPDF, see TCPDF documentation for more informations about PDF generation.
PDF Output
ACTcpdfBundle provide helpers to serve your PDF
Display the PDF in the browser
Return a Response with Content-Disposition: inline
$myPdf->inline('my-pdf.doc');
Download the PDF
Return a Response with Content-Disposition: attachment
$myPdf->download('my-pdf.doc');
Get the PDF as base64 mime multi-part email attachment (RFC 2045)
$myPdf->attachment('my-pdf.doc');
Save the PDF on a filesystem
$myPdf->save('/path/to/my-pdf.doc');
Output the PDF as string
$myPdf->toString();
MultiCell Helper
AC\TcpdfBundle\Pdf\PdfBuilder::addMultiCellRow($cells, $sameHeight, $nobr) allow you to build complex tables, based on MultiCell.
$cells is a multidimensional array. Each cell (array) contains :
- The data (text or html)
- The options. Available options :
heightCell heightwidthCell widthborderDraw the cell borders. Allowed values : 0 or 1. Default = 0alignHorz alignment. Allowed values : 'L' (left), 'C' (center), 'R' (right) or 'J' (justify). Default = 'T'valignVert alignment. Allowed values 'T' (top), 'M' (middle) or 'B' (bottom). Default = 'T'fillIndicates if the cell background must be painted. true or false. Default = falseis_htmlIndicate if the data is html. See TCDPF doc for the supported tags. Default = false
$sameHeight If set to true all the row cells have the same height. Default = false.
$nobr If set to true the row is not break across 2 pages. Default = false.
Example
$data = [ ['foo' => 'AAA', 'bar' => 123, 'baz' => '<b>text<b>'], ['foo' => 'BBB', 'bar' => 456, 'baz' => '<a href="https://domain.td">link</a>'], ['foo' => 'CCC', 'bar' => 789, 'baz' => '<ul><li>line 1</li><li>line 2</li></ul>'], ]; foreach ($data as $row) { $pdf->addRowCell([ [$row['foo'], ['with' => 30]], [$row['bar'], ['width' => 40, 'align' => 'R']], [$row['baz'], ['width' => 50, 'is_html' => true]], ]); }
License
This bundle is under the MIT license. See the complete license in the bundle
acucchieri/tcpdf-bundle 适用场景与选型建议
acucchieri/tcpdf-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 849 次下载、GitHub Stars 达 1, 最近一次更新时间为 2017 年 07 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「symfony」 「pdf」 「TCPDF」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 acucchieri/tcpdf-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 acucchieri/tcpdf-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 acucchieri/tcpdf-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
TCPDF is a PHP class for generating PDF documents and barcodes.
The bundle for easy using json-rpc api on your project
TCPDI is a PHP class for importing PDF to use with TCPDF
TCPDI is a PHP class for importing PDF to use with TCPDF
Modified version of TCPDF that includes option for setting barcode's bar width
Bundle Symfony DaplosBundle
统计信息
- 总下载量: 849
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-07-07