TCPDF - How to adjust height of header?

ryaa picture ryaa · Mar 31, 2011 · Viewed 36.8k times · Source

I am using TCPDF to convert html to pdf format. I am passing a string into the php script to be set as my header. I am having a hard time setting the height of my header. I have tried using SetMargins(PDF_MARGIN_LEFT, 0, PDF_MARGIN_RIGHT) and SetHeaderMargin(0). What it did was to only take off the top margin. I have also alternately looked into adjusting the height of the cell which contains the string within the header.

$this->Cell(0, 0, $newHeaderString, 0, false, 'C', 0, '', 0, false, 'M', 'M');

No luck eliminating white space here either.

I have included an image to show what white space I want to eliminate. The white space is between the header text and the hr tag from the html. Any help would be appreciated!

Link to image

Answer

Seyeong Jeong picture Seyeong Jeong · Nov 28, 2011

You could define the PDF_MARGIN_TOP constant or you could set the margin explicitly:

$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);