TCPDF: HTML table and page breaks

后端 未结 8 1359
刺人心
刺人心 2021-01-31 04:04

I am creating a large HTML table and I have problem with page breaks as you can see in the following image:

Is there a method settle down the problem automatically? Or

8条回答
  •  不知归路
    2021-01-31 04:34

    Strangely enough the solutions mentioned here didn't work for me. Well, it did sortof, but content inside of tags would get repeated (as desired) but would then cause layout issues for the cell above or below if it was rowspanned. As I experimented, it just got worse.

    My solution, while inelegant, was to set AutoPageBreak to false, put a row incrementer counter up, incrementing for each row, then checked if it had exceeded a certain value. If so, I closed the table, used writeHTML(), called addPage() and then continued , having rebuilt it as a new table, headers and all.

    Like I said, inelegant, but it worked. I hope this helps someone ... it's a fairly obvious solution but execution is not always quite so obvious. Also, there may be a better way that works for your particular situation, but if it doesn't, give mine a try. :)

提交回复
热议问题