forked from science-ation/science-ation
Properly wrap signature lines when they reach a page break
Fix the signature page to only display once ALL the sections are complete
This commit is contained in:
parent
659bc11066
commit
db600b5eb4
21
lpdf.php
21
lpdf.php
@ -475,20 +475,41 @@ class lpdf
|
|||||||
|
|
||||||
function addTextX($text,$xpos)
|
function addTextX($text,$xpos)
|
||||||
{
|
{
|
||||||
|
$fontsize=pdf_get_value($this->pdf,"fontsize",0);
|
||||||
|
$lineheight=ceil($fontsize*1.2);
|
||||||
|
|
||||||
|
//we do it before here, to make sure we never get too low
|
||||||
|
if($this->yloc< (0.9 + $lineheight/72) )
|
||||||
|
$this->newPage();
|
||||||
pdf_show_xy($this->pdf,$text,$this->loc($xpos),$this->loc($this->yloc));
|
pdf_show_xy($this->pdf,$text,$this->loc($xpos),$this->loc($this->yloc));
|
||||||
}
|
}
|
||||||
|
|
||||||
function nextLine()
|
function nextLine()
|
||||||
{
|
{
|
||||||
|
$fontsize=pdf_get_value($this->pdf,"fontsize",0);
|
||||||
|
$lineheight=ceil($fontsize*1.2);
|
||||||
|
|
||||||
$this->yloc-=$this->currentFontSize*1.4/72;
|
$this->yloc-=$this->currentFontSize*1.4/72;
|
||||||
|
|
||||||
|
//new page check can come after the nextline call
|
||||||
|
if($this->yloc< (0.9 + $lineheight/72) )
|
||||||
|
$this->newPage();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function hr()
|
function hr()
|
||||||
{
|
{
|
||||||
|
$fontsize=pdf_get_value($this->pdf,"fontsize",0);
|
||||||
|
$lineheight=ceil($fontsize*1.2);
|
||||||
|
|
||||||
pdf_moveto($this->pdf,$this->loc($this->page_margin-0.25),$this->loc($this->yloc));
|
pdf_moveto($this->pdf,$this->loc($this->page_margin-0.25),$this->loc($this->yloc));
|
||||||
pdf_lineto($this->pdf,$this->loc($this->page_width-$this->page_margin+0.25),$this->loc($this->yloc));
|
pdf_lineto($this->pdf,$this->loc($this->page_width-$this->page_margin+0.25),$this->loc($this->yloc));
|
||||||
pdf_stroke($this->pdf);
|
pdf_stroke($this->pdf);
|
||||||
$this->yloc-=0.25;
|
$this->yloc-=0.25;
|
||||||
|
|
||||||
|
//again we do it after the nextline call
|
||||||
|
if($this->yloc< (0.9 + $lineheight/72) )
|
||||||
|
$this->newPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
function hline($x1,$x2)
|
function hline($x1,$x2)
|
||||||
|
@ -192,7 +192,7 @@ echo "<table><tr><td>";
|
|||||||
|
|
||||||
//signature page
|
//signature page
|
||||||
echo "<tr><td>";
|
echo "<tr><td>";
|
||||||
if($statusstudent=="complete" && $statusproject=="complete" && $statusmentor=="complete" && $statussafety=="complete")
|
if($statusstudent=="complete" && $statusproject=="complete" && $statusmentor=="complete" && $statussafety=="complete" && $statusemergencycontact=="complete" && $statustour=="complete")
|
||||||
{
|
{
|
||||||
if($sigfile)
|
if($sigfile)
|
||||||
echo "<a href=\"$sigfile\">";
|
echo "<a href=\"$sigfile\">";
|
||||||
@ -200,7 +200,7 @@ echo "<table><tr><td>";
|
|||||||
echo error(i18n("No PDF generation library detected"),true);
|
echo error(i18n("No PDF generation library detected"),true);
|
||||||
}
|
}
|
||||||
echo i18n("Signature Page");
|
echo i18n("Signature Page");
|
||||||
if($statusstudent=="complete" && $statusproject=="complete" && $statusmentor=="complete" && $statussafety=="complete")
|
if($statusstudent=="complete" && $statusproject=="complete" && $statusmentor=="complete" && $statussafety=="complete" && $statusemergencycontact=="complete" && $statustour=="complete")
|
||||||
echo "</a>";
|
echo "</a>";
|
||||||
echo "</td><td>";
|
echo "</td><td>";
|
||||||
echo i18n("Print");
|
echo i18n("Print");
|
||||||
|
@ -129,6 +129,13 @@ $pdf->newPage();
|
|||||||
|
|
||||||
foreach($studentinfoarray AS $studentinfo)
|
foreach($studentinfoarray AS $studentinfo)
|
||||||
{
|
{
|
||||||
|
//we want to make sure the vspace, line, and text under the line dont
|
||||||
|
//get wrapped onto multiple pages, so make sure we have enough space for the whole thing before we
|
||||||
|
//start, and if we dont, make a new page. normal stop for footer is at 0.9, so 1.65 gives 0.75 inches
|
||||||
|
//which should be enough... i think :)
|
||||||
|
if($pdf->yloc< 1.65 )
|
||||||
|
$pdf->newPage();
|
||||||
|
|
||||||
$pdf->vspace($height['sigspace']);
|
$pdf->vspace($height['sigspace']);
|
||||||
|
|
||||||
//signature line
|
//signature line
|
||||||
@ -162,6 +169,13 @@ $pdf->newPage();
|
|||||||
|
|
||||||
foreach($studentinfoarray AS $studentinfo)
|
foreach($studentinfoarray AS $studentinfo)
|
||||||
{
|
{
|
||||||
|
//we want to make sure the vspace, line, and text under the line dont
|
||||||
|
//get wrapped onto multiple pages, so make sure we have enough space for the whole thing before we
|
||||||
|
//start, and if we dont, make a new page. normal stop for footer is at 0.9, so 1.65 gives 0.75 inches
|
||||||
|
//which should be enough... i think :)
|
||||||
|
if($pdf->yloc< 1.65 )
|
||||||
|
$pdf->newPage();
|
||||||
|
|
||||||
$pdf->vspace($height['sigspace']);
|
$pdf->vspace($height['sigspace']);
|
||||||
|
|
||||||
//signature line
|
//signature line
|
||||||
@ -192,6 +206,14 @@ $pdf->newPage();
|
|||||||
$teacherbox=$r->text;
|
$teacherbox=$r->text;
|
||||||
$pdf->addText($teacherbox);
|
$pdf->addText($teacherbox);
|
||||||
|
|
||||||
|
//we want to make sure the vspace, line, and text under the line dont
|
||||||
|
//get wrapped onto multiple pages, so make sure we have enough space for the whole thing before we
|
||||||
|
//start, and if we dont, make a new page. normal stop for footer is at 0.9, so 1.65 gives 0.75 inches
|
||||||
|
//which should be enough... i think :)
|
||||||
|
if($pdf->yloc< 1.65 )
|
||||||
|
$pdf->newPage();
|
||||||
|
|
||||||
|
|
||||||
//we only need 1 teacher signature line, we can assume (maybe incorrectly) that both students
|
//we only need 1 teacher signature line, we can assume (maybe incorrectly) that both students
|
||||||
//have the same teacher.. if they are not the same, then they can get the best teacher to sign
|
//have the same teacher.. if they are not the same, then they can get the best teacher to sign
|
||||||
//it doesnt matter.
|
//it doesnt matter.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user