PHP / TCPDF: Template Bug?

后端 未结 3 814
悲哀的现实
悲哀的现实 2021-02-04 03:20

I have been using TCPDF for sometime. It\'s simple to use, outputs low size PDF and is under active development. Following is the code for a page which should only have Hello Wo

3条回答
  •  时光取名叫无心
    2021-02-04 04:06

    In case this is not solved for anyone else here and they are using FPDI to import a template, try looking at the calculated page height from FPDI and the resultant page height from TCPDF. For me they did not match, and to get rid of the black line I had to add 8 to the page height, and subtract 7 from the y-ordinate value in the useTemplate function in addition to setPrintHeader(false), like this:

    $tplidx = $pdf->ImportPage($i);
    $s = $pdf->getTemplateSize($tplidx);
    // TCPDF STUFF, AddPage(), etc.
    $pdf->useTemplate($tplidx,0,-7,$s['w'],$s['h']+8);
    

提交回复
热议问题