Menu

#1004 autopagebreak not always works

v1.0_(example)
closed
nobody
None
1
2015-01-05
2014-12-09
Remi COLLET
No

The usual code (from example_001, with a loop to raise page break)

for ($i=1 ; $i<=100 ; $i++) {
  $txt = "Dummy <b>$i</b>";
  $pdf->writeHTMLCell(0, 0, '', '', $txt, 0, 1, 0, true, '', true);
  printf("+ %d\n", $pdf->getY());
}

Works as expected (GetY grow, and is reset after page break)

Below code, which should be equiv. to previous (using ->Ln() instead)

for ($i=1 ; $i<=100 ; $i++) {
  $txt = "Dummy <b>$i</b>";
  $pdf->writeHTMLCell(0, 0, '', '', $txt, 0, 0, 0, true, '', true);
  $pdf->Ln();
  printf("+ %d\n", $pdf->getY());
}

Doesn't work. GetY is never reset, so, on second page, all lines are displayed at the same place.

Discussion

  • Nicola Asuni

    Nicola Asuni - 2014-12-09

    This is correct.
    The $reseth parameters reset the lasth value at the beginning of the htmlblock, not at the end.
    To reset the lasth you have to call resetLastH() before Ln()

     
  • Nicola Asuni

    Nicola Asuni - 2014-12-09
    • status: open --> closed
     
  • Remi COLLET

    Remi COLLET - 2014-12-09

    This issue is not about "lasth", but about "Y"

     
  • Nicola Asuni

    Nicola Asuni - 2014-12-09

    It is a kind of known side effect.
    lasth needs to be reset.
    I will investigate anyway to see if there is something I can do about it.

     
  • Remi COLLET

    Remi COLLET - 2014-12-10
    Post awaiting moderation.

Log in to post a comment.