How to remove line below header and above $html in TCPDF?

限于喜欢 提交于 2019-12-23 10:07:02

问题


How to remove line below header and above $html in TCPDF?

http://www.tcpdf.org/examples/example_001.pdf

tcpdf.org/examples.php (examples with PDF ang PHP code!)

in this example this is line below http://www.tcpdf.org and above Welcome to TCPDF. How can i remove this?


回答1:


As shown on the tcpdf website - examples in exemple 002 there is no header and here is the php code example.

The "magic" is done by this code:

// remove default header/footer
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);

and that is it! Hope it helps




回答2:


You can remove it by subclassing TCPDF class, and overriding the methods Header() and Footer():

class MyTCPDF extends TCPDF
{
   public function Header()
   {
      // NOP! Overrides default header
   }
   public function Footer()
   {
      // NOP! Overrides default footer
   }
}



回答3:


I V tried writing this code,^_^

it works for both header & footer.

$pdf->setPrintHeader(false);

$pdf->setPrintFooter(false);




回答4:


While I prefer the chosen answer by jnhghy - Jantea Alexandru, the following is an alternative way to do it if you just need something quick:

Change the following code:

$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 058', PDF_HEADER_STRING);

to

$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 058', PDF_HEADER_STRING, array(0,0,0), array(255,255,255));

This simply sets the color of the line to white (the background color of the page). The first array of colors is for the header text color, the second array of colors is for the header line color.




回答5:


We can edit tcpdf.php file,

From:

protected $header_line_color = array(0,0,0); 

To :

protected $header_line_color = array(255,255,255);

That's it.



来源:https://stackoverflow.com/questions/10601353/how-to-remove-line-below-header-and-above-html-in-tcpdf

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!