字段更改值时尝试在FPDF中进行分页

时间:2018-10-25 18:43:42

标签: php fpdf

我正在使用FPDF来告诉老师有关过期书籍的信息。输出显示部门,书号和姓氏。部门名称更改时,如何强制分页符。

问题:我需要进入Department并执行 测试该值是否与上一个不同。我做 不知道如何进入部门做测试,如果与生俱来 分页符。

This a code segment:

class 
PDF extends PDF_MySQL_Table
{
function Header()
{
$currentDate = date("n/j/Y");

$this->SetFont('Arial','',18);
$this->Cell(0,6,'Over Due List',0,1,'C');
 $this->SetFont('Arial','',12);
$this->Cell(0,6,'(Title Left Out for Privacy)',0,1,'C');
 $this->SetFont('Arial','',12);
$this->Cell(0,6,  ' Date: ' .$currentDate,0,1,'C');
$this->Ln(10);
// Ensure table header is printed
parent::Header();
}
function Footer()
 {
// Position at 1.5 cm from bottom
$this->SetY(-15);
// Arial italic 8
$this->SetFont('Arial','I',8);
// Page number
$this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');

}
}




$pdf = new PDF();
$pdf->AliasNbPages();
pdf->AddPage();

$pdf->AddCol('Department',40,'Department','C');
$pdf->AddCol('LastName',60,'Last Name','C');
$pdf->AddCol('bookid',20,'Material#','L');
$pdf->AddCol('loandate',25,'Due Date','C');
//------------
//********** 

$pdf->Table($link,"SELECT Mbook.BOOKNUM,
Mbook.TITLE,
Eloans.bookid,
Eloans.loandate,
Eloans.borroid,
people.Borronum,
people.FirstName,
people.LastName,
people.Department
FROM(
Mbook
INNER JOIN Eloans ON Mbook.BOOKNUM = Eloans.bookid
LEFT JOIN people ON Eloans.borroid = people.Borronum)
order by People.Department Desc");

$pdf->Output();
?>

0 个答案:

没有答案