DefHeaderByName()
(mPDF ≥ 2.0)
DefHeaderByName – Define a page header with a given name
Description
void DefHeaderByName ( [ string $name [, array $header ]])
Define a page header with a given name. Named headers can be referenced and set later in the document e.g. SetHeaderByName()
Note: Do not name any header or footer starting with html_
This prefix is reserved to identify an
HTML header/footer when passing its name in a reference.
Note: This function/method was altered in mPDF 2.2 by capitalising the first letter of the name. As function/method names in PHP have hitherto been case-insensitive, this should not cause any problems, but it is recommended where possible to use the preferred spelling.
Parameters
- $name
-
User-defined name for the header. If $name
= ''
(blank) the name_default
is used. - $header
-
This parameter specifies the content of the page header as an array.
Default: array()
Values in the array
- L: subarray for left
- C: subarray for center
-
R: subarray for right
Subarray with following entries:
- content: TEXT STRING
- font-size: FLOAT font size in pts
- font-style:
'B'
|'I'
|'BI'
|BLANK STRING - font-family: Any available font-family
- color: CSS
#RRGGBB
string
- line:
0
|1
- specify whether to draw a line under the Header
<?php $header = array ( 'L' => array ( 'content' => '', 'font-size' => 10, 'font-style' => 'B', 'font-family' => 'serif', 'color'=>'#000000' ), 'C' => array ( 'content' => '', 'font-size' => 10, 'font-style' => 'B', 'font-family' => 'serif', 'color'=>'#000000' ), 'R' => array ( 'content' => 'My document', 'font-size' => 10, 'font-style' => 'B', 'font-family' => 'serif', 'color'=>'#000000' ), 'line' => 1, );
Changelog
Version | Description |
---|---|
2.0 | The function was added. |
Examples
For examples and further information please see: