Skip to content
Advertisement

Generating PDF with dompdf and getting empty space in the first tr after page break

I have faced very weird bug when using dompdf for generating PDFs. Problem occures when page break takes place inside of the table. After the page break, first tr on the following page has some weird empty space on the left side (picture below shows the problem).

enter image description here

I have tried setting the page-break-inside: avoid; to avoid breaking the table, but that didn’t solve the problem. In that case, empty space is being added to the same tr even if it’s not the first tr on the page any longer.

Any suggestions on how to solve this and remove that empty space?

Advertisement

Answer

I managed to fix the problem eventually. The weird behaviour was caused by display: inline-block; that was set on the some childs of the td. Removing display: inline-block;, and somehow rewriting the logic using table, fixed my problem.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement