Reputation: 4080
Is it possible to change the font size of characters in the header? All font settings I've tried only seem to affect the body of the PDF file.
Upvotes: 1
Views: 7648
Reputation: 4029
If you are using the default headers, call this before you call the AddPage method.
$pdf->setHeaderFont(array('fontnamehere', 'stylehere', fontsize));
For example, here's one I used with my own project:
$pdf->setHeaderFont(array('playtime', '', 20));
Which set the header to use the regular-styled playtime font (a font I added to my installation) at 20pt. I assume it's points anyway. The array isn't documented anywhere I could find, which is typical of TCPDF documentation. I should note that larger sizes may not fit like you expect, so you can set the content container's top margin to allow more space for a different sized header, like this:
$topheader = 40; //Just an example, new top margin in current TCPDF units.
$pdf->SetMargins(PDF_MARGIN_LEFT, $topheader, PDF_MARGIN_RIGHT);
And I'd like to take a moment again to stress that it should be called before AddPage is called, I learned a hard lesson regarding that myself.
If you want to do more complex headers, you can also write your own Header
and Footer
methods by extending the class, as in example 3 on the TCPDF site.
Upvotes: 4