TCPDF: HTML table and page breaks

后端 未结 8 1345
刺人心
刺人心 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:43

    Try adding this to your <tr> tags: nobr="true".

    So a quick example would be:

    <table>
        <tr nobr="true">
            <td>Test</td>
            <td>Test 2</td>
        </tr>
    </table>
    

    The nobr="true" prevents the table rows from ever breaking apart. You can also put this on <td> and <th> tags.

    0 讨论(0)
  • 2021-01-31 04:43

    I had the same problem with overlapping headers. I tried yevgeny solution, but that required some more editions to my PDF generator code (I have lots of PDFs outputs written in FPDF and I wanted to minimize the process of miograting them to TCPDF), so I used this more simple solution

    class MYPDF extenfs TCPDF {
        //your initialization code
        function header(){
            //your code here
    
            //we change only the top margin and this executes for every header in every page, even the frst one
            $this->SetTopMargin($this->GetY());
        }
    }
    
    0 讨论(0)
提交回复
热议问题