PDF report footer issue on next page

Hi Everyone.

I have a PDF report which is set to create an new page when there are too many items added to my application and this work very well except when there is a second page the footer information from my first page is still visible and should not be.

Any ideas how i can stop this from happening, it is an invoice so the totals should only appear once at the bottom of which ever page is last, below is the code i’m using.

 /*------------------ Page 1 -----------------*/
        $items = 0;
		$y_position = sc_pdf_get_y();
		sc_pdf_sub_sel_init();
        foreach ({items} as $NM_ind => $Dados)
        { 
			//$itemst++;
		    //if ($items > 30) {
			//    sc_pdf_add_page();
   			//	$items = 0;
			//	$y_position = 15;
			//}
		    //f ($y_position > 100) { 
			//    sc_pdf_add_page();
    		//	$y_position = 15; 
			//}
            sc_pdf_print_sub_sel($cell_items_pitem_code[$NM_ind]);
            sc_pdf_print_sub_sel($cell_items_pitem_desc[$NM_ind]);
            sc_pdf_print_sub_sel($cell_items_pitem_qty[$NM_ind]);
            sc_pdf_print_sub_sel($cell_items_pitem_unit_price[$NM_ind]);
            sc_pdf_print_sub_sel($cell_items_pitem_total[$NM_ind]);				
            sc_pdf_sub_sel_end();
			sc_pdf_set_auto_page_break(true,0);
        }
		$y = sc_pdf_get_y();


      /*-------------------------------------------*/