fix some alignment issues with the table, make sure it moves down the appropriate amounts at the appropriate times!

This commit is contained in:
james 2005-01-18 17:45:26 +00:00
parent 162475b62c
commit 421e7f43d9
2 changed files with 15 additions and 8 deletions

View File

@ -12,6 +12,7 @@ if($catr=mysql_fetch_object($catq))
);
$pdf->newPage();
$pdf->setFontSize(11);
$q=mysql_query("SELECT registrations.id AS reg_id,
registrations.num AS reg_num,
registrations.status,

View File

@ -152,9 +152,12 @@ class lpdf
function heading($text)
{
pdf_setfont($this->pdf,$this->headerfont,12);
//move down the full line height
$this->yloc-=12/72;
pdf_show_xy($this->pdf,$text,$this->loc(0.5),$this->loc($this->yloc));
$this->yloc-=6/72; //half a line
pdf_setfont($this->pdf,$this->normalfont,$this->currentFontSize);
//now leave some space under the heading (4 is 1/3 of 12, so 1/3 of the line height we leave)
$this->yloc-=4/72;
}
@ -164,6 +167,7 @@ class lpdf
$height['tabledata']=0.18;
$xpos_of_table=0.5;
$this->yloc-=$height['tableheader'];
$top_of_table=$this->yloc;
$table_width=array_sum($table['widths']);
@ -196,7 +200,6 @@ class lpdf
$xpos+=$width;
}
$this->yloc-=$height['tableheader'];
}
//now do the data in the table
@ -205,6 +208,7 @@ class lpdf
pdf_setfont($this->pdf,$this->normalfont,10);
foreach($table['data'] AS $dataline)
{
$this->yloc-=$height['tabledata'];
$xpos=$xpos_of_table;
for($c=0;$c<$table_cols;$c++)
{
@ -219,7 +223,6 @@ class lpdf
pdf_lineto($this->pdf,$this->loc($xpos_of_table+$table_width),$this->loc($this->yloc));
pdf_stroke($this->pdf);
$this->yloc-=$height['tabledata'];
if($this->yloc<1)
{
//now draw all the vertical lines
@ -229,18 +232,21 @@ class lpdf
$width=$table['widths'][$c];
//draw the line below the table data)
pdf_moveto($this->pdf,$this->loc($xpos),$this->loc($top_of_table+$height['tableheader']));
pdf_lineto($this->pdf,$this->loc($xpos),$this->loc($this->yloc+$height['tableheader']-.02));
pdf_lineto($this->pdf,$this->loc($xpos),$this->loc($this->yloc));
pdf_stroke($this->pdf);
$xpos+=$width;
}
//and the final line on the right side of the table:
pdf_moveto($this->pdf,$this->loc($xpos),$this->loc($top_of_table+$height['tableheader']));
pdf_lineto($this->pdf,$this->loc($xpos),$this->loc($this->yloc+$height['tableheader']-.02));
pdf_lineto($this->pdf,$this->loc($xpos),$this->loc($this->yloc));
pdf_stroke($this->pdf);
$this->newPage();
$this->yloc-=$height['tableheader'];
$top_of_table=$this->yloc;
//draw the top line of the table (above the table header)
pdf_moveto($this->pdf,$this->loc($xpos_of_table),$this->loc($this->yloc+$height['tableheader']));
pdf_lineto($this->pdf,$this->loc($xpos_of_table+$table_width),$this->loc($this->yloc+$height['tableheader']));
@ -267,7 +273,6 @@ class lpdf
$xpos+=$width;
}
$this->yloc-=$height['tableheader'];
}
pdf_setfont($this->pdf,$this->normalfont,10);
}
@ -281,14 +286,14 @@ class lpdf
$width=$table['widths'][$c];
//draw the line below the table data)
pdf_moveto($this->pdf,$this->loc($xpos),$this->loc($top_of_table+$height['tableheader']));
pdf_lineto($this->pdf,$this->loc($xpos),$this->loc($this->yloc+$height['tableheader']-.02));
pdf_lineto($this->pdf,$this->loc($xpos),$this->loc($this->yloc));
pdf_stroke($this->pdf);
$xpos+=$width;
}
//and the final line on the right side of the table:
pdf_moveto($this->pdf,$this->loc($xpos),$this->loc($top_of_table+$height['tableheader']));
pdf_lineto($this->pdf,$this->loc($xpos),$this->loc($this->yloc+$height['tableheader']-.02));
pdf_lineto($this->pdf,$this->loc($xpos),$this->loc($this->yloc));
pdf_stroke($this->pdf);
}
@ -330,6 +335,7 @@ class lpdf
$this->page_subheader=$subheader;
$this->pagenumber=0;
//add the stuff to the first page
// $this->addHeaderAndFooterToPage();
}