TCPDF: sometime add new page then next page content overflows

≯℡__Kan透↙ 提交于 2019-12-06 09:30:14

I was facing the same issue and engineering solution for this problem ended up as a combination of magic constants and usage of addPage if my calculation showed that we should do a manual page break:

$top_margin = 82;
[...]
if ($pdf->getY() > (300 /* A4 height */ - $top_margin + 40 /* another magic constant */)) {
    $pdf->addPage();
}

After writing each row. In your case, you would probably need to adjust the constants, but this solved my problems.

It looks like a bug, that the library is willing to write behind the end of the page region. I don't think, we can get this fixed, because author already moved to development of a new PDF library tc-lib-pdf.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!