Project

General

Profile

BUGFIX @Fpdf Advanced Table(Utf8) - 5.3.1 tfpdf_table/classes/Pdf/Table.php

Added by Adriano Mendes about 6 years ago

First of all good job doing this.
I first bought in 2014 and now renew in 2018.
Bug found in tfpdf_table_5.3.1 (old versions have the same) - With Header and Footer the second page (with pageBreak) the Table becames over Footer.
Its no easy for debug, so i had to take some time to re-learn since my code was made in 2014. I thought it was version, so i bought the new version. The error still so i re-coded my class and the bug was the same.
It's so easy that even hurts.

Folder: tfpdf_table_5.3.1/tfpdf_table/classes/Pdf/Table.php
In function: function _cachePaginate()
In Line 1472 change [$iLeftHeight = $iPageHeight;] to [$iLeftHeight = $iPageHeight - $this->oPdf->GetY() + $this->oPdf->tMargin;]

Voilá


Replies (11)

RE: BUGFIX @Fpdf Advanced Table(Utf8) - 5.3.1 tfpdf_table/classes/Pdf/Table.php - Added by Adriano Mendes about 6 years ago

This makes the Header be fixed BUT create bug in table size when inserted text before.
File: classes/pdf/Table.php

From the debug i made - the bug is between _cachePaginate and insertNewPage.I quite dont understand the cycles in full scale coz is back and front.
I have made a ugly fix at fix but it's not good code - when insertNewPage i mess with $iPageHeight but since i cannot get the getx updated it's awful.

From the code untouched (without my "fix") Table @version : 5.3.0 when run _cachePaginate and then insertNewPage i think it should made:

  • detect the new getY and generate the new table value;
  • in current cycle detect that and if needed be possible to run several pagebreaks;

It's my assumption i dont know if it's right !

Thanks!

RE: BUGFIX @Fpdf Advanced Table(Utf8) - 5.3.1 tfpdf_table/classes/Pdf/Table.php - Added by Andrei Bintintan about 6 years ago

I was just going to ask for a sample; can you please provide also the code you used to generate this case?

RE: BUGFIX @Fpdf Advanced Table(Utf8) - 5.3.1 tfpdf_table/classes/Pdf/Table.php - Added by Andrei Bintintan about 6 years ago

Thanks, I'll have a look. Please have a bit of patience; i'm overloaded ....

RE: BUGFIX @Fpdf Advanced Table(Utf8) - 5.3.1 tfpdf_table/classes/Pdf/Table.php - Added by Adriano Mendes about 6 years ago

Dont worry i know that feeling pretty well.
If I had been able to update correctly i would posted online.
I have my fingers crossed.

RE: BUGFIX @Fpdf Advanced Table(Utf8) - 5.3.1 tfpdf_table/classes/Pdf/Table.php - Added by Andrei Bintintan over 5 years ago

I've tried to reproduce this with old and new libraries and the result is the same. Attached is the pdf I get generated. Not sure where the bug is. It is generated with tfpdf version 5.3.1, it's the one you have.

Can you please point out the issue. Thanks.

PPS: sorry again for the extreme delayed answer.

doc.pdf View doc.pdf 71.3 KB

RE: BUGFIX @Fpdf Advanced Table(Utf8) - 5.3.1 tfpdf_table/classes/Pdf/Table.php - Added by Adriano Mendes over 5 years ago

Greetings,
thanks for your answer,

Strangely this bug happens in my CentOS machines - all the files where provided in my previous posts. I've made other fix's from that version i dont know if its bcause my language is latin-1.
I guess i gonna try to migrate but is quite dificult since i have coded a class to simplyfie your hole class and other features.

RE: BUGFIX @Fpdf Advanced Table(Utf8) - 5.3.1 tfpdf_table/classes/Pdf/Table.php - Added by Andrei Bintintan over 5 years ago

If the class works for you, you can stick to it. There were several bugfixes, but no dramatic changes. And I can't foresee big changes in the pdf generation libraries...
See here the roadmap.

https://tracker.interpid.eu/projects/pdf-addons/wiki/Roadmap-table

RE: BUGFIX @Fpdf Advanced Table(Utf8) - 5.3.1 tfpdf_table/classes/Pdf/Table.php - Added by Beat Binotto about 5 years ago

Hi

I have exactly the same bug.
I temp. fixed it by adding $iPageHeight = $iPageHeight - $this->oPdf->bMargin;
after 1151. Not sure about side effects.. But maybe this givs a hint.

I upgraded from a very old version of fpdf_table and did not have that problem with that old version.

RE: BUGFIX @Fpdf Advanced Table(Utf8) - 5.3.1 tfpdf_table/classes/Pdf/Table.php - Added by Andrei Bintintan about 5 years ago

I will re-open #1356 but I need more feedback on this issue.
Please make the following: disable your header/footer functions and make sure that those do not change the Y coordinates upon exit; that can mess the things up.
@Beat - your case is a typical case for the header modifying the Y coordinates. See attached screenshots.

    (1-11/11)