To make an image or a PDF page as background or template for the forms:

  • Use any pdf file as background image for pdf report:
  • Pput the pdf template file in reporting/forms folder;
  • After creating FrontReport object call SetHeaderType() method passing basename of the template file;
  • Refer reporting/includes/header2.inc - this is typical template file for document layout.
  • The files pdf.report.inc and excel.report.inc in the folder reporting/includes have a property in their class called $headerTmpl which is set to Header by default enabling the default inclusion of includes/header.inc file. If, for instance, SetHeaderType('Header2') is issued, then includes/header2.inc would get included by - function Header2() - instead which is the Header for sales/purchase documents. Similarly, if SetHeaderType('Header3') is used, then function Header3() is executed. It is the function by that name that is included and that function can choose to include any other file. The function Header3() is an alternate header style which also supports a simple footer.
  • Search for $rep->SetHeaderType('Header2'); in some of the reporting/*.php files and you will see how and where to include the function name.

To add any additional constant elements printed on every page (like titles, additional graphics):

  • Create *.php file with the same base name.
  • Place it in the reporting/forms folder.
  • Put any needed code in it.

How the template page is used:

  • The pages in template file are used in cycle.
  • If there is only one page in template file - this page will be used for every page of report generated.
  • If your template has 3 pages and the generated report has 4 - the last page of report will use page 1 as background again.