반응형
<?php
use setasign\Fpdi;
require_once('tcpdf/tcpdf.php');
require_once('fpdi/autoload.php');
// initiate PDF
$pdf = new Fpdi();
$pdf->SetMargins(PDF_MARGIN_LEFT, 40, PDF_MARGIN_RIGHT);
$pdf->SetAutoPageBreak(true, 40);
$pagecount = $pdf->setSourceFile('a.pdf');
for($i=1; $i<=$pagecount; $i++){
$pdf->addPage();
$tplId = $pdf->importPage($i);
$pdf->useTemplate($tplId);
$pdf->SetTextColor(255,0,0);
$pdf->SetXY(55,27);
$pdf->Cell(30, 0, "test", 0, $ln=0, 'C', 0, '', 0, false, 'T', 'L');
}
$pdf->Output('output.pdf', 'I');
반응형