mochrira / selvi-report
该包最新版本(0.3.7)没有提供许可证信息。
一个使用selvi框架生成pdf的库
0.3.7
2024-06-07 11:33 UTC
Requires
- phpoffice/phpspreadsheet: ^1.23
- tecnickcom/tcpdf: ^6.3
This package is auto-updated.
Last update: 2024-09-07 11:56:42 UTC
README
这是一个使用TCPDF制作的PDF报告库,它采用了FastReport©早已提出的Band系统来创建报告。
安装
composer require mochrira/selvi-pdf
启动
<?php
require 'vendor/autoload.php';
$pdf = new \Selvi\Pdf();
$pdf->pageStart([
'margins' => ['bottom' => .5, 'top' => .5]
]);
$pdf->pageHeader(function ($pdf) {
$pdf->rowStart();
$pdf->column('Page Header');
$pdf->rowEnd();
});
$pdf->band(function ($pdf) {
$pdf->rowStart();
$pdf->column('Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.', ['width' => '50%', 'multiline' => false, 'border' => 1]);
$pdf->column('Halo', ['width' => '50%']);
$pdf->rowEnd();
});
$pdf->pageFooter(function ($pdf) {
$pdf->rowStart();
$pdf->column('Page '.$pdf->PageNo());
$pdf->rowEnd();
});
$pdf->pageEnd();
$pdf->render();
?>
主Band
...
$pdf->masterStart();
$pdf->masterHeader(function ($pdf) {
$pdf->rowStart();
$pdf->column('Master Header 1');
$pdf->rowEnd();
});
for($i=1; $i<=125; $i++) {
$pdf->masterBand(function ($pdf) use ($i) {
$pdf->rowStart();
$pdf->column('Master Band 1 - '.$i);
$pdf->rowEnd();
});
}
$pdf->band(function ($pdf) {
$pdf->rowStart();
$pdf->column('Master Footer uses generic band'.$i);
$pdf->rowEnd();
$pdf->Ln();
});
$pdf->masterEnd();
...