PDF生成框架。

dev-master 2023-08-29 22:48 UTC

This package is auto-updated.

Last update: 2024-08-30 00:48:57 UTC


README

PDF文档生成、保存或输出文档。

实际的PDF文档生成是通过使用特定PDF库的独立可替换包来完成的。

有关许可证信息,请查看LICENSE文件。

安装

安装此扩展的首选方式是通过composer

运行以下命令之一:

composer require --prefer-dist BeastBytes/pdf

或者将以下内容添加到您的composer.json文件的require部分:

"beastbytes/pdf": "~1.0.0"

require

基本用法

$document = $pdf
    ->generate('viewName')
    ->withAuthor('A. U. Thor')
    ->withSubject('Subject')
    ->withTitle('Title')
;    

$pdf->output($document, Pdf::DESTINATION_INLINE);

本地化视图

文档可以使用withLocale()方法使用本地化视图。

$document = $pdf
    ->withLocale('de_DE')
    ->generate('viewName')
    ->withAuthor('A. U. Thor')
    ->withSubject('Subject')
    ->withTitle('Title')
;    

$pdf->output($document, Pdf::DESTINATION_INLINE);