Detailed Description
PDFTemplate is used to output pdf files based on a given pdf template.
PDFTemplate uses FPDI/FPDF. PDFPage instances are used to render data onto the template pages.
The following example shows the usage:
Definition at line 43 of file PDFTemplate.php.
Public Member Functions | |
__construct ($pdf) | |
setTemplate ($filename) | |
setPages ($pages, $cycle=false, $data=null) | |
output ($name='', $dest='') | |
Public Attributes | |
$_pdf = null | |
$_tpl = null | |
$_pages = array() | |
$_cycle = false | |
$_data = null | |
Constructor & Destructor Documentation
__construct | ( | ) |
Constructor.
Definition at line 55 of file PDFTemplate.php.
Member Function Documentation
setTemplate | ( | $filename | ) |
Set the template filename.
- Parameters
-
$filename The name of the file
Definition at line 68 of file PDFTemplate.php.
setPages | ( | $pages, | |
$cycle = false , |
|||
$data = null |
|||
) |
Set the PDFPage instances used to write the content to the template.
The page instances will be used one after another: The 1 instance writes to the first template page, the second to the second and so on. Use the cycle parameter to cycle the instances (e.g. if the same data should be written to every template page, put one instance into the pages array and set cycle to true)
- Parameters
-
$pages An array of PDFPage instances $cycle Boolean whether to cycle the PDFPage instances or not (default: false) $data An optional data object, that will passed to the PDFPage::render method (default: null)
Definition at line 82 of file PDFTemplate.php.
output | ( | $name = '' , |
|
$dest = '' |
|||
) |
Output the pdf.
Delegates to FPDF::Output()
- Parameters
-
$name The name of the pdf file $dest The pdf destination ('I': browser inline, 'D': browser download, 'F': filesystem, 'S': string)
- Returns
- The document string in case of dest = 'S', nothing else
Definition at line 95 of file PDFTemplate.php.
Member Data Documentation
$_pdf = null |
Definition at line 45 of file PDFTemplate.php.
$_tpl = null |
Definition at line 46 of file PDFTemplate.php.
$_pages = array() |
Definition at line 47 of file PDFTemplate.php.
$_cycle = false |
Definition at line 48 of file PDFTemplate.php.
$_data = null |
Definition at line 49 of file PDFTemplate.php.