Bug in sc_pdf_add_page() / sc_pdf_get_y()

Hi,

i have the following code in the body-section of my pdf report:

        /*------------------ Page 1 -----------------*/ 

sc_pdf_print_img($cell_BarcodeNachweisID, 0, 0);
sc_pdf_print($cell_DebitorName1);
sc_pdf_print($cell_Ansprechpartner);
sc_pdf_print($cell_DebitorStrasse);
sc_pdf_print($cell_DebitorPLZ);
sc_pdf_print($cell_DebitorOrt);
sc_pdf_set_y(115);

        foreach ({NachweisDetails} as $NM_ind => $Dados)

{
sc_pdf_print_sub_sel($cell_NachweisDetails_Datum[$NM_ind]);
sc_pdf_print_sub_sel($cell_NachweisDetails_Start[$NM_ind]);
sc_pdf_print_sub_sel($cell_NachweisDetails_Ende[$NM_ind]);
sc_pdf_print_sub_sel_mult($cell_NachweisDetails_Beschreibung[$NM_ind], 4.23333333333);
sc_pdf_print_sub_sel($cell_NachweisDetails_AnzahlAE[$NM_ind]);
sc_pdf_print_sub_sel($cell_NachweisDetails_Anfahrt[$NM_ind]);
sc_pdf_sub_sel_end(5);

if (sc_pdf_get_y() >= 220)
{
sc_pdf_add_page();
sc_pdf_set_y(115);
}

}

sc_pdf_print($cell_MitarbeiterID);
sc_pdf_print($cell_Datum);
/-------------------------------------------/

The code is originally from SC, except the bold marked code. I will generate a new page, when the number of subitems no longer fits on the current page.

This works, but only for the next (one) position. sc_pdf_get_y() is then at once greater than 220, although it should be no more than 120. Looks as if an internal counter is not reset in SC …

Hello,

I’m not sure if I understood the issue correctly. Is SC altering your value from 120 to 220? Is that the issue?

regards,
Bernhard Bernsmann

Hi Bernhard,

First SC make a AddPage because the value from sc_pdf_get_y() ist greater than 220. That is ok. SC then prints one of the next items and then makes a AddPage again! Although the value of sc_pdf_get_y() is not really greater than 220 (it’s about space for 10 positions on one page).

In the generated source code you can be seen that a variable for the Y-position is incremented, but never reset at a AddPage.

Hello,

Issue reported to our bugs team.

regards,
Bernhard Bernsmann