apsg / certificate
创建PDF证书
0.1.0
2021-04-30 11:12 UTC
Requires
- apsg/fpdi-fpdf: v2.3.1
- illuminate/support: ~5|~6
Requires (Dev)
- mockery/mockery: ^1.1
- orchestra/testbench: ~3|~4
- phpunit/phpunit: ^8.0
- sempro/phpunit-pretty-print: ^1.0
This package is auto-updated.
Last update: 2024-09-30 01:28:39 UTC
README
这是一个辅助包,用于提供简单的PDF证书生成功能。它底层使用FPDI/FPDF,并配置为支持波兰语。它作为Laravel 5/6的包工作,但并没有添加很多Laravel特定的功能,因此也可以在其他项目中使用。
安装
通过Composer
$ composer require apsg/certificate
使用方法
use Apsg\Certificate\Certificate; use Apsg\Certificate\Fields\Field; use Apsg\Certificate\Formats\A4LandscapeFormat; class CertificateController extends Controller { /** * This will output the pdf to browser to download */ public function test() { $certificate = new Certificate(null, new A4LandscapeFormat()); return $certificate ->setBackground(storage_path('app/public/tlo.png')) ->addField(new Field('test zażółć gęślą', 10, 100, 20)) ->generate(); } }
注意:背景会被拉伸以填充页面,因此请使用适当的分辨率和方向以获得最佳效果。
测试
$ composer test