Difference between revisions of "PDF Invoice Customisation"

From WHMCS Documentation

Line 10: Line 10:
  
 
The PDF's are generated using TCPDF & you can find a full list of available functions to help you build your template @ http://www.tecnick.com/pagefiles/tcpdf/doc/com-tecnick-tcpdf/TCPDF.html
 
The PDF's are generated using TCPDF & you can find a full list of available functions to help you build your template @ http://www.tecnick.com/pagefiles/tcpdf/doc/com-tecnick-tcpdf/TCPDF.html
 +
 +
==Displaying Custom Fields==
 +
 +
We have a special How-To guide for displaying custom field values on invoices available here: [[Showing Custom Fields on PDF Invoices]]
  
 
==Available Variables==
 
==Available Variables==
  
The following variables are available for usage in the invoicepdf.tpl file.
+
The following variables are available for use in the invoicepdf.tpl file and further data can be obtained by running SQL queries directly from within the template which does allow custom PHP code to be executed.
  
 
*$datecreated - The date the invoice was created
 
*$datecreated - The date the invoice was created

Revision as of 17:05, 24 September 2010

The logo displayed on the PDF invoices is located in the images folder. To change this to your own logo simply upload your logo to the images folder and name it "logo.jpg".

You can also set a width for the logo image in the invoicepdf.tpl template file. On line 4, just add ",50" before the closing bracket ); on that line. That sets the width to 50. You can then experiment increasing and decreasing it until happy.

Editing Text & Content

You can fully customize the PDF invoices such as adding or removing text, altering the layout or adding furthur images & formatting. This is done by editing the template file invoicepdf.tpl in your active template folder. The file contains all the code relating to the layout and display of the invoice in its PDF format. You will need a basic working knowledge of PHP coding in order to understand and modify the file.

The PDF's are generated using TCPDF & you can find a full list of available functions to help you build your template @ http://www.tecnick.com/pagefiles/tcpdf/doc/com-tecnick-tcpdf/TCPDF.html

Displaying Custom Fields

We have a special How-To guide for displaying custom field values on invoices available here: Showing Custom Fields on PDF Invoices

Available Variables

The following variables are available for use in the invoicepdf.tpl file and further data can be obtained by running SQL queries directly from within the template which does allow custom PHP code to be executed.

  • $datecreated - The date the invoice was created
  • $duedate - The date the invoice is due
  • $datepaid - Shows paid date/time if invoice is set to Paid
  • $userid - Client ID Number
  • $clientsdetails["firstname"] - Client Info First Name
  • $clientsdetails["lastname"] - Client Info Last Name
  • $clientsdetails["companyname"] - Client Info Company Name
  • $clientsdetails["fieldname"] - etc...
  • $clientsdetails["customfields1"] - Client Info Custom Field #1
  • $subtotal
  • $tax
  • $taxrate
  • $credit
  • $total
  • $status - Paid, Unpaid or Cancelled
  • $paymentmethod
  • $notes
  • $companyname - Your Company Name
  • $companyurl - Your Default Website URL
  • $companyaddress - Your Company Address
  • $currencysymbol - Active Currency Symbol
  • $invoiceitems - Array of invoice items