PHP / TCPDF: Template Bug?

后端 未结 3 805
悲哀的现实
悲哀的现实 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 03:53

    The horizontal line is defined on the default Header(). You can either override the Header() method as on example n. 3 or disable the header as on the example n. 2. Check the TCPDF website at http://www.tcpdf.org and consult the official forum for further information.

    0 讨论(0)
  • 2021-02-04 03:59

    just do this $pdf->setPrintHeader(false); and the line at the top will go away

    0 讨论(0)
  • 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);
    
    0 讨论(0)
提交回复
热议问题