|
More problems with File_PDF
Hello
Making some good headway with File_PDF, but I've come across a problem. Currently, I'm trying to recreate a purchase order invoice. I thought I had it dialed until I carry it across two or more pages.
I'm using a combination of multiCell() and cell() methods to create columns. The problem is when I page break, the the second column (which I setXY) is grabbing the position of the second page vs the beginning of the first page. I thought I'd try to do some math by subtracting page height depending on how many pages, but page one would be 'empty' for that column, but the remainder would show properly on page 2.
I'm hoping there is a easy work around for this (ie: setting page, etc) before the second column work.
Here is an example of what I'm doing:
PHP Code:
// COLUMN 1 Line Items [items]
$x = 5;
$y = 100;
$width = 105;
$p->setY($y);
$p->setFont('arial', 'B', 8);
$p->cell($width,0, "Item");
$p->setXY($x,$y + 6);
$pageHeight = $p->getPageHeight();
$p->setFont('arial', '', 8);
for($i = 0; $i < 25; $i++){
$p->multiCell($width,4,"xxxxxxx / Data Mngr Server Lic/SA",0,'L',0);
$p->multiCell($width,4,"xxxxxxx / Data Ent Mgmt Lic/SA",0,'L',0);
$p->multiCell($width,4,"xxxxxxx / Data Std Mgmt Lic/SA",0,'L',0);
}
// COLUMN 2 Line Items [qty]
$x = 105;
$y = 100;
$width = 10;
$p->setXY($x,$y);
$p->setFont('arial', 'B', 8);
$p->cell($width,0," Qty",0,0,'C',0);
$p->setXY($x,$y + 6);
$p->setFont('arial', '', 8);
for($i = 0; $i < 25; $i++){
$p->multiCell($width,4,"9",0,'C',0);
$p->setX($x);
$p->multiCell($width,4,"80",0,'C',0);
$p->setX($x);
$p->multiCell($width,4,"120",0,'C',0);
$p->setX($x);
}
So basically 'qty' starts at Y position 100 on page 2 vs 100 position on page 1. If the purchase order does not break the page, then columns look perfect.
Any suggestions are greatly appreciated!!!
hanji
|