PDF customization

The TCPDF library is used to create PDF documents. While extending the TCPDF class, I have tried to follow the TCPDF author’s convention to start method names with a capital letter.

It is possible to customize the layout of invoices and quotations by extending the two classes InvoicePDF and QuotationPDF respectively.

The directory plugins/pdf contains all custom PDF layout implementations. Have a look at the file invoice_example.php to see a sample customization. Refer to the full implementation in lib/pdf.php to see which methods and members can be used and overwritten.

Invoices

Give your class a speaking name (for example AcmeInvoicePDF) and name the file accordingly (plugins/pdf/acme_invoice.php).

This class must extend the class InvoicePDF.

Quotations

In order to customize the layout of quotations, the class QuotationPDF must be extended.

Sitewide settings

In the Sitewide settings section, under the PDF Settings tab, the desired templates can be selected for both invoices and quotations. In the case of the above example, the option AcmeInvoicePDF will show up in the Invoice template selection box.

Table Of Contents

Previous topic

Translations

Next topic

Billing plugins