Try to check nessesary space before printing. If u've got space enouth, call section, or insert page break otherwise.
Something like this:
PHP код:
boolean fEndLine = false;
int q1, q2, q3, q4;
;
/* Debuging information, uncomment to see the nessasary parameters
q1 = element.getPageHeight();
q2 = element.currentYmm100()/100;
q3 = CustInvoiceTransLog_FLX_Body_4.heightValue();
q4 = PageFooter_Sum.heightValue();
*/
if ((lineNum != 0) &&(cntRec - lineNum) == 1) //if you want print summary with the LAST record
{
if ( //sum all sections, then check height
((element.getPageHeight() - element.currentYmm100()/100) <=
(.....ctrlBody.heightValue() +
PageFooter_Sum.heightValue() + ctrlReportFooterSum.heightValue()+
ctrlFooterInv1.heightValue() + ctrlFooterInv2.heightValue())) &&
((element.getPageHeight() - element.currentYmm100()/100) > 0)
)
{
fEndLine = true; //need to insert page breaking
element.executeSection(ctrlPageFooterSum);
element.newPage();
}