diff --git a/lpdf.php b/lpdf.php index b85a151b..e6a067f9 100644 --- a/lpdf.php +++ b/lpdf.php @@ -475,20 +475,41 @@ class lpdf 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)); } function nextLine() { + $fontsize=pdf_get_value($this->pdf,"fontsize",0); + $lineheight=ceil($fontsize*1.2); + $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() { + $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_lineto($this->pdf,$this->loc($this->page_width-$this->page_margin+0.25),$this->loc($this->yloc)); pdf_stroke($this->pdf); $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) diff --git a/register_participants_main.php b/register_participants_main.php index e29f341f..76bea4c7 100644 --- a/register_participants_main.php +++ b/register_participants_main.php @@ -192,7 +192,7 @@ echo "
"; //signature page echo "
"; - if($statusstudent=="complete" && $statusproject=="complete" && $statusmentor=="complete" && $statussafety=="complete") + if($statusstudent=="complete" && $statusproject=="complete" && $statusmentor=="complete" && $statussafety=="complete" && $statusemergencycontact=="complete" && $statustour=="complete") { if($sigfile) echo ""; @@ -200,7 +200,7 @@ echo "
"; echo error(i18n("No PDF generation library detected"),true); } 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 ""; echo ""; echo i18n("Print"); diff --git a/register_participants_signature.php b/register_participants_signature.php index d2fc9f14..912ddcf6 100644 --- a/register_participants_signature.php +++ b/register_participants_signature.php @@ -129,6 +129,13 @@ $pdf->newPage(); 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']); //signature line @@ -162,6 +169,13 @@ $pdf->newPage(); 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']); //signature line @@ -192,6 +206,14 @@ $pdf->newPage(); $teacherbox=$r->text; $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 //have the same teacher.. if they are not the same, then they can get the best teacher to sign //it doesnt matter.