kitpages / pdf-bundle
Symfony PdfBundle
dev-master
2013-05-15 13:12 UTC
Requires
- php: >=5.3.2
- symfony/framework-bundle: *
This package is auto-updated.
Last update: 2024-09-04 19:28:19 UTC
README
Pdf: FPDF和FPDI的简单封装,用于Symfony
安装
使用composer update
在app/appKernel.php中添加新的Bundle
使用示例
use Kitpages\PDFBundle\lib\PDF;
$pdf = new PDF(); $pagecount = $pdf->setSourceFile('oldPdf.pdf');
for($i = 1; $i <= $pagecount; $i++){ $tplIdx = $pdf->importPage($i); $s = $pdf->getTemplatesize($tplIdx); $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L', array($s['w'], $s['h']), true); // This gets it the right dimensions $pdf->useTemplate($tplIdx, 0, 0, 0, 0, true); $pdf->SetFont('Arial','',8); $pdf->SetTextColor(168,168,168); $pdf->SetY(20); $pdf->SetX(80); $pdf->Write(0, '修改我的PDF'); } $pdf->Output('newPdf.pdf, 'D');