php generate pdf
代码
<?php
require_once(dirname(__FILE__)."/lib/fpdf/fpdf.php");
require_once(dirname(__FILE__)."/lib/fpdi/fpdi.php");
$filename = "file/template.pdf";
$pdf=new FPDI('P','mm','Legal');
//page one
$pdf->AddPage();
$pdf->setSourceFile($filename);
$tplIdx = $pdf->importPage(1);
$pdf->useTemplate($tplIdx);
//default autonumber
$pdf->SetFont('Arial','B',12);
$pdf->Cell(135);
$pdf->Cell(50,12,'sss',0,0,'L');
//A1
$pdf->Ln(26);
$pdf->SetFont('Arial','B',10);
$pdf->Cell(47);
$pdf->Cell(50,12,'xxxx',0,0,'L');
//A2,A3,A4,A5
$pdf->Ln(4);
$pdf->SetFont('Arial','B',10);
$pdf->Cell(47);
$pdf->Cell(50,12,'xxxx',0,0,'L');
//B1
$pdf->Ln(16);
$pdf->SetFont('Arial','B',10);
$pdf->Cell(47);
$pdf->Cell(50,12,'xxxxx',0,0,'L');
//B2,B3,B4,B5
$pdf->Ln(7);
$pdf->SetFont('Arial','B',10);
$pdf->Cell(47);
$pdf->Cell(50,12,'xxxxxx',0,0,'L');
//B6
$pdf->Ln(5);
$pdf->SetFont('Arial','B',10);
$pdf->Cell(47);
$pdf->Cell(50,12,'xxxxx',0,0,'L');
//page two
$pdf->AddPage();
$pdf->setSourceFile($filename);
$tplIdx = $pdf->importPage(2);
$pdf->useTemplate($tplIdx);
//default autonumber
$pdf->SetFont('Arial','B',9);
$pdf->Cell(152);
$pdf->Cell(50,9,'xxxx',0,0,'L');
header("Content-Transfer-Encoding", "binary");
header('Cache-Control: maxage=3600'); //Adjust maxage appropriately
header('Pragma: public');
$pdf->Output();
//$pdf->Output('document.pdf', 'D');
?>
require_once(dirname(__FILE__)."/lib/fpdf/fpdf.php");
require_once(dirname(__FILE__)."/lib/fpdi/fpdi.php");
$filename = "file/template.pdf";
$pdf=new FPDI('P','mm','Legal');
//page one
$pdf->AddPage();
$pdf->setSourceFile($filename);
$tplIdx = $pdf->importPage(1);
$pdf->useTemplate($tplIdx);
//default autonumber
$pdf->SetFont('Arial','B',12);
$pdf->Cell(135);
$pdf->Cell(50,12,'sss',0,0,'L');
//A1
$pdf->Ln(26);
$pdf->SetFont('Arial','B',10);
$pdf->Cell(47);
$pdf->Cell(50,12,'xxxx',0,0,'L');
//A2,A3,A4,A5
$pdf->Ln(4);
$pdf->SetFont('Arial','B',10);
$pdf->Cell(47);
$pdf->Cell(50,12,'xxxx',0,0,'L');
//B1
$pdf->Ln(16);
$pdf->SetFont('Arial','B',10);
$pdf->Cell(47);
$pdf->Cell(50,12,'xxxxx',0,0,'L');
//B2,B3,B4,B5
$pdf->Ln(7);
$pdf->SetFont('Arial','B',10);
$pdf->Cell(47);
$pdf->Cell(50,12,'xxxxxx',0,0,'L');
//B6
$pdf->Ln(5);
$pdf->SetFont('Arial','B',10);
$pdf->Cell(47);
$pdf->Cell(50,12,'xxxxx',0,0,'L');
//page two
$pdf->AddPage();
$pdf->setSourceFile($filename);
$tplIdx = $pdf->importPage(2);
$pdf->useTemplate($tplIdx);
//default autonumber
$pdf->SetFont('Arial','B',9);
$pdf->Cell(152);
$pdf->Cell(50,9,'xxxx',0,0,'L');
header("Content-Transfer-Encoding", "binary");
header('Cache-Control: maxage=3600'); //Adjust maxage appropriately
header('Pragma: public');
$pdf->Output();
//$pdf->Output('document.pdf', 'D');
?>