xaoc/laravel-tcpdf
Composer 安装命令:
composer require xaoc/laravel-tcpdf
包简介
A simple Laravel 5 service provider with some basic configuration for including the TCPDF library
README 文档
README
A simple Laravel 5 service provider with some basic configuration for including the TCPDF library
Installation
The Laravel TCPDF service provider can be installed via composer by requiring the xaoc/laravel-tcpdf package in your project's composer.json. (The installation may take a while, because the package requires TCPDF. Sadly its .git folder is very heavy)
{
"require": {
"xaoc/laravel-tcpdf": "dev-master"
}
}
Next, add the service provider to app/config/app.php.
'providers' => [ //.. 'Xaoc\LaravelTcpdf\LaravelTcpdfServiceProvider', ]
That's it! You're good to go.
Here is a little example:
PDF::SetTitle('Hello World'); PDF::AddPage(); PDF::Write(0, 'Hello World'); PDF::Output('hello_world.pdf');
For a list of all available function take a look at the TCPDF Documentation
Configuration
Laravel-TCPDF comes with some basic configuration. If you want to override the defaults, you can publish the config, like so:
php artisan vendor:publish
Now access app/config/laravel-tcpdf.phpto customize.
Extend/Overwrite
Extending or overwriting Laravel TCPDF is easy. Simply extend \Xaoc\LaravelTcpdf\LaravelTcpdf with your own class.
Custom Fonts
To add custom fonts set the fonts_directory in the config, relative to the public path. For example 'fonts/'.
To use a custom font you have to convert a font for TCPDF.
Copy your custom font(s) to your fonts path, in our case public/fonts/.
In your terminal do this:
vendor/xaoc/laravel-tcpdf/vendor/tecnick.com/tcpdf/tools/tcpdf_addfont.php -i public/fonts/yourfont.ttf -o public/fonts
This uses a little tool provided by TCPDF to convert fonts for TCPDF.
The -i flag is for the input fonts (comma-separated list)
and the -o flag is for the output directory.
Read here all about TCPDF fonts and how to convert them the new way.
xaoc/laravel-tcpdf 适用场景与选型建议
xaoc/laravel-tcpdf 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 16.01k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2015 年 03 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「pdf」 「TCPDF」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 xaoc/laravel-tcpdf 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 xaoc/laravel-tcpdf 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 xaoc/laravel-tcpdf 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
TCPDF is a PHP class for generating PDF documents and barcodes.
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
Provides TCPDF integration for Symfony
Alfabank REST API integration
统计信息
- 总下载量: 16.01k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 23
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-03-12