我正在使用FPDF从PHP生成pdf文件。但我遇到的一个困难是,当文件很大时,它将覆盖页脚内容和页眉内容的下一页。我需要帮助。
class PDF extends FPDF {
// Page header
function Header() {
// Logo
$this->Image('custom/pics/logoo.png', 8, 15, 20);
// Arial bold 15
$this->SetFont('Arial', 'B', 15);
// Move to the right
$this->Cell(30);
// Title
$this->Cell(30, 20, 'Payment Request', 0, 0, 'C');
// Line break
$this->Ln(20);
}
// Page footer
function Footer() {
// Position at 1.5 cm from bottom
$this->SetY(-25);
// Arial italic 8
$this->SetFont('Arial', '', 6);
// Page number
$this->Cell(0, 3, 'Price Quoted: ETB including VAT', 0, 1, 'L');
$this->Cell(0, 3, 'Delivery Period: Already installed and configured.', 0, 1, 'L');
$this->Cell(0, 3, 'Remarks: Make all checks payable to Mella COMMUNICATION TECHNOLOGY PLC', 0, 1, 'L');
$this->SetFont('Arial', 'I', 8);
$this->Cell(0, 3, 'THANK YOU FOR YOUR BUSINESS!', 0, 0, 'C');
$this->Cell(0, 3, 'Page ' . $this->PageNo() . '/{nb}', 0, 0, 'R');
}
}
// Instanciation of inherited class
$pdf = new PDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFillColor(176, 179, 177);
$pdf->SetFont('Arial', '', 8);
//Installed Vehicle list with details
if (isset($_POST["device_pdf"])) {
$for = count($_POST["device_pdf"]);
$item_no += 1;
$pdf->SetFont('Arial', 'B', 8);
$pdf->Cell(70, 7, $item_no . '. Device Purchase', 'L,R', 0, 'L');
$pdf->Cell(25, 7, "", 'L,R', 0);
$pdf->Cell(30, 7, "", 'L,R', 0);
$pdf->Cell(25, 7, "", 'L,R', 0);
$pdf->Cell(40, 7, "", 'L,R', 1);
$pdf->SetFont('Arial', '', 7);
}
}
这只是整个代码的一个片段。