On line guide/help
You are on page 43 of the online help. Navigate sequentially through the guide pages or search for a topic of interest to you.
Index Prev. NextPHP API reference
Public methods of the PDFReport class
Public methods and properties of the PDFReport class (namespace AlienProject\PDFReport). All the methods throw an Exception with a description of the problem when an error occurs.
Template
__construct(string $xmlTemplateFileName = '') Creates the report. If the file name is set, the template is loaded (see LoadTemplate).
LoadTemplate(string $xmlTemplateFileName = '') Loads the XML template from a file. Throws an exception if the file is not readable.
SetTemplate(string $xmlTemplate = '') Loads the XML template from a string, eg. read from a database field. Throws an exception if the XML is not valid, with the position and the reason of the error.
Data
SetVar(string $varkey, $varvalue, bool $overwrite = true): bool Sets a variable
SetVars(array $varkeyValueList, bool $overwrite = true): bool Sets more variables (associative array name => value)
GetVar(string $varkey, $defaultValue = '') Returns the value of a variable
SetSection(string $sectionId, $dataProvider = null, $page = null): PDFReportSection Links a data provider to the section with the given id
SetDatalist(string $datalistId, $dataProvider = null): PDFDatalist Links a data provider to the chart datalist with the given id
Formatting and output
SetFormatCallback(callable $callback): void Sets a custom function for the value formatting
FormatValue(string $fieldKey, $fieldValue): string Formats a value with a format mask
BuildReport(): string Generates the report. Returns the PDF document when the output destination is S or E, an empty string otherwise (version 1.0.11 or later).
Public properties:
$version Library version, eg. '1.0.11 - 29/09/2026'
$pdf The TCPDF object used to create the document. It is created by the BuildReport method.
The other public methods (PdfBox, PdfLine, PdfRectangle, PdfCircle, SetOpacity, ..) are used internally by the chart classes.
Typical use of the PDFReport class