Use HTML and CSS in PDF themes
If you have an understanding of HTML and CSS principles, you can edit PDF themes in more detail. This enables you to include variables in the theme which are then replaced with their values when the document is produced.
You should only use edit the HTML and CSS if you’re confident in your understanding. We are unable to give any advice or support on HTML or CSS.
If you are not devising a PDF theme entirely from scratch, it is advisable that you create the them using Clean as the template.
-
Go to Settings. (If you've switched to the new design, select your initials, then Account Settings.)
-
From the Configuration Settings section, select PDF Themes.
-
Select the required PDF theme, then the HTML & CSS tab.
-
Choose the are of the document you want to edit by selecting the appropriate tab.
-
Edit the HTML or CSS as required then select Save & Exit. The following variables can be used:
Variable Name | Replaced with | ||||||||||||||||||
[SENDER_ADDRESS_COMPANY] | The company name recorded in your company details | ||||||||||||||||||
[SENDER_ADDRESS_LINE1] [SENDER_ADDRESS_LINE2] [SENDER_ADDRESS_LINE3] [SENDER_ADDRESS_LINE4] | The address recordedin your company details | ||||||||||||||||||
[SENDER_ADDRESS_POSTCODE] |
The post code recorded in your company details |
||||||||||||||||||
[SENDER_ADDRESS_PHONE] | The telephone number recorded in your company details. | ||||||||||||||||||
[SENDER_ADDRESS_EMAIL] | The email address recorded in your company details. | ||||||||||||||||||
[SENDER_ADDRESS_SINGLELINE] | A compilation of the address recorded in your company details in the format of
[SENDER_ADDRESS_COMPANY], [SENDER_ADDRESS_LINE1], [SENDER_ADDRESS_LINE2], [SENDER_ADDRESS_LINE3], [SENDER_ADDRESS_LINE4], [SENDER_ADDRESS_POSTCODE] |
||||||||||||||||||
[SENDER_ADDRESS_MULTILINE] | A compilation of the address recorded in your company details in the format of
[SENDER_ADDRESS_COMPANY] [SENDER_ADDRESS_LINE1] [SENDER_ADDRESS_LINE2] [SENDER_ADDRESS_LINE3] [SENDER_ADDRESS_LINE4] [SENDER_ADDRESS_POSTCODE] |
||||||||||||||||||
[DOCUMENT_TITLE] | The name of the document type the PDF Theme is generating e.g. Invoice, Quote, Customer Statement, etc. | ||||||||||||||||||
[RECIPIENT_ADDRESS] | A compilation of the address stored for the customer in the format of Name Address Line 1 Address Line 2 Address Line 3 Address Line 4 Post Code Country |
||||||||||||||||||
[LOGOFILE] | The URL of the Logo that has been uploaded for the PDF Theme . | ||||||||||||||||||
[ADDITIONAL_TEXT] | The text entered in the Additional Text field on the Misc Options. | ||||||||||||||||||
[STAMP_IMG] | The URL to the default PAID and OVERDUE stamps of invoices. | ||||||||||||||||||
[PAYONLINE_LINK] | The URL to the appropriate payment processor gateway for the associated invoice. | ||||||||||||||||||
[PAYONLINE_IMG] | The URL to the Payment Button image (as specified in Settings’ > Card Options. When given the ID of “#payment-button” the element will only appear on emailed documents. | ||||||||||||||||||
[DOC_INFO_BORDER] | If you have chosen to Include a border on the document details section then this variable will be replaced with the string “docInfoBorder”, otherwise it will be replaced with an empty string. | ||||||||||||||||||
[RECIP_ADDR_BORDER] | If you have chosen toInclude a border on the document details section then this variable will be replaced with the variable will be replaced with the string “recipAddrBorder”, otherwise it will be replaced with an empty string. | ||||||||||||||||||
[ADDITIONAL_TEXT_BORDER] | If you have chosen to Include a border on the additional text sectionthen this variable will be replaced with the string “addTextBorder”, otherwise it will be replaced with an empty string. | ||||||||||||||||||
[DOCUMENT_LINES] | The compiled iteration over the “LINES.HTML” template. | ||||||||||||||||||
[DOCUMENT_TOTALS] | The compiled iteration over the “LINES_TOTALS.HTML” template. | ||||||||||||||||||
[VATNUMINFO] | Your VAT number recorded in Company Details with a pre-fix as defined on the Field Names tab of the respective PDF Theme. | ||||||||||||||||||
[SHORT_NARRATIVE] | Used with Receipt of Payment, and Remittance Advice document types. A brief on the Payment Transaction in the format of: Payment of {Payment Value} received on {Transaction Date} Payment Method: {Payment Method} {Transaction Comment}. | ||||||||||||||||||
[LONG_NARRATIVE] | Used with reminder letters. Consists of all the text specified within the respective reminder letters Edit field. | ||||||||||||||||||
[CONTACT] | The full name of the contact for the recipient company. | ||||||||||||||||||
[CUSTREF] |
|
||||||||||||||||||
|
|||||||||||||||||||
[PAYMENTTERMS] | An Payment Terms as specified for the respective Customer or Supplier record. This simply returns the number, without a unit of measure | ||||||||||||||||||
[TEL] | The phone number recorded for the recipient. | ||||||||||||||||||
[FAX] | The fax number recorded for the recipient. | ||||||||||||||||||
[MOBILE] | The mobile number recorded for the recipient. | ||||||||||||||||||
[TOTAL] | The total of the respective document. |
The following labels are used in the document details
Variable name | Replaced with | ||||||||||||||||||
[INFO_LABEL_1] |
|
||||||||||||||||||
[INFO_LABEL_2] |
|
||||||||||||||||||
[INFO_LABEL_3] |
|
||||||||||||||||||
[INFO_LABEL_4] |
|
||||||||||||||||||
[INFO_LABEL_5] |
|
||||||||||||||||||
[INFO_LABEL_6] Will not display if you have specified to show projects per line item |
|
||||||||||||||||||
[INFO_LABEL_7] |
|
The following refer to the values of the Document Details
Variable name | Replaced with | ||||||||||||||||||||
[INFO_VALUE_1] |
|
||||||||||||||||||||
[INFO_VALUE_2] |
|
||||||||||||||||||||
[INFO_VALUE_3] |
|
||||||||||||||||||||
[INFO_VALUE_4] |
|
||||||||||||||||||||
[INFO_VALUE_5] |
|
||||||||||||||||||||
[INFO_VALUE_6] Will not display if you have specified to show Projects per Line Item |
|
||||||||||||||||||||
[INFO_VALUE_7] |
|
The following refer to the headers of Document Lines
Variable name | Replaced with | ||||||||||||||||||
[COLA_HEADER] Will not display on Quotes if you have chosen Remove Qty field from Invoices from the Field Names tab of the PDF Theme |
|
||||||||||||||||||
[COLB_HEADER] |
|
||||||||||||||||||
[COLC_HEADER] |
|
||||||||||||||||||
[COLD_HEADER] |
|
||||||||||||||||||
[COLE_HEADER] Will not display on Invoices/ Quotes/ Purchases if you are not set-up as to be VAT Registered |
|
||||||||||||||||||
[COLF_HEADER] |
|
The following variables are replaced with various class names needed to control the column display. You can include a combination of any of the following: smallCol, alignLeft, alignCenter.
Variable name | Replaced with | ||||||||||||||||||
[COLA_CLASSES]
Will not display on Quotes if you have chosen Remove Qty field from Invoices from the Field Names tab of the PDF Theme |
|
||||||||||||||||||
[COLB_HEADER] |
|
||||||||||||||||||
[COLC_HEADER] |
|
||||||||||||||||||
[COLD_HEADER] |
|
||||||||||||||||||
[COLE_HEADER]
Will not display on Invoices/ Quotes/ Purchases if you are not set-up as to be VAT Registered |
|
||||||||||||||||||
[COLF_HEADER] |
|
The following variables are intended for use within the “DOCUMENT.CSS” template
Variable name | Replaced with |
[FONT] | Name of the font family specified on The Basics tab of the PDF theme. |
[FONTSIZE] | Font size (pt) as specified on The Basics tab of the PDF theme. |
[FONTCOLOR] | Font colour in hexadecimal as specified on The Basics tab of the PDF theme. |
Inserted CSS
We append some additional CSS to your template. This is either to hide sections (as the same template is used by all Document Types) or due to various other Settings defined within the IRIS KashFlow account. Reviewing the details below along with the HTML used in our “Clean” template should assist you in creating your own templates.
Condition | CSS |
INFO_LABEL_4 is empty | #docinfo_4 {display:none;} |
INFO_LABEL_5 is empty | #docinfo_5 {display:none;} |
INFO_LABEL_6 is empty or Projects defined not to be displayed on documents | #docinfo_6 {display:none;} |
[SENDER_ADDRESS_*] is empty (eg, SENDER_ADDRESS_COMPANY, SENDER_ADDRESS_LINE1 etc.) | .sender-address-* {display:none;} (eg, .sender-address-company {display:none;} .sender-address-line1 {display:none;} etc.) |
User is not VAT registered or set their VAT Number not to show on the documents | #vat-registration-info {display:none;} |
Totals do not need to be shown | #document-totals {display:none;} |
column-* does not need to be shown (eg,column-a, column-f etc.) | .column-* {display:none;} (eg, .column-a {display:none;} .column-f {display:none;} etc.) |
No Document Lines need to be shown (for document types like Remittance Advice, Reminder Letters etc.) | #document-lines {display:none;} |
The Overdue and Paid Stamps are defined to not be displayed, or the Document is not an Overdue or Paid Invoice | #stamp-image {display:none;} |
The Payment Button is not defined to be displayed, or the Document is not an Unpaid Invoice | #payment-button {display:none;} |
The document is not a Reminder Letter | #long-narrative {display:none;} |
The document is not either Remittance Advice, or Receipt of Payment | #short-narrative {display:none;} |
The PDF Theme has no Logo uploaded for it, or it is defined to not be shown | #logo{display:none;visibility:hidden;} |
The user has defined a Left or Right property beneath the PDF Themes “Borders & Margins” tab Note: Top and Bottom Margins are handled automatically by the PDF conversion process | #pdfdoc{margin-left:(x)px; margin-right:(y)px;} |
If the font is set to Helvetica, we need to unbold headings (to match legacy settings) | #pdfdoc #document-lines th, #pdfdoc h1{font-weight:normal;} |
Line Templates
As well as the “DOCUMENT.HTML” and “DOCUMENT.CSS” templates there are three additional templates for the Line Items, Line Comments, and Totals of a document. These will rarely ever require editing, though can be.
LINES.HTML
This is repeated for each line of information (eg, an invoice line) in the document.
It’s important to keep the class information for each column as per the “Clean” theme:
<tr>
<td class="[COLA_CLASSES] column-a">[COLA_VALUE]</td>
<td class="[COLB_CLASSES] column-b">[COLB_VALUE]</td>
<td class="[COLC_CLASSES] column-c">[COLC_VALUE]</td>
<td class="[COLD_CLASSES] column-d">[COLD_VALUE]</td>
<td class="[COLE_CLASSES] column-e">[COLE_VALUE]</td>
<td class="[COLF_CLASSES] column-f">[COLF_VALUE]</td>
</tr>
LINES_COMMENT.HTML
This is used instead of lines.html when the line being rendered is a single cell such as a comment line:
<tr>
<td colspan="6" class="alignLeft">[COLB_VALUE]</td>
</tr>
LINES_TOTALS.HTML
This is used to generate the Document Totals beneath the main Document Lines table. It is also used for Receipt of Payments, and Remittance Advice where multiple lines need to be displayed, such as if the Payment was for multiple Invoices or Purchases:
<tr class="[class]">
<td>[label]:</td>
<td>[value]</td>
</tr>
Document spec classes
You may find need to be able to apply a different layout or formatting depending on the Document Type, and the case of Invoices, their status. This is achieved by defining a html tag within the DOCUMENT.HTML template with the class [DOCUMENT_SPECS]. For example:
<html class="[DOCUMENT_SPECS]">
Depending on the document being rendered, the variable will output the following classes:
Invoice: invoice is-paid/is-unpaid/ is-overdue is-creditNote
Packing slip: packingSlip
Quote: quote
Remittance Advice: remittanceAdvice
Payment Receipt: paymentReceipt
Purchase Order: purchaseOrder
Customer Statement: customerStatement
Supplier Statement: supplierStatement
Reminder Letter: reminderLetter
For example, if the document being rendered is an unpaid credit note, the following HTML will be rendered:
<html class="invoice is-creditNote is-unpaid">
A common example of the Document Type class being used is to insert a specialised “Additional Text” element to appear for Customer Statements. This is achieved by first creating an element within the DOCUMENT.HTML sheet within the existing “additional-text” element. For example:
<div id="additional-text" class="[ADDITIONAL_TEXT_BORDER]">
<div class="original_addText">[ADDITIONAL_TEXT]</div>
<div class="custom_addText">Some text to appear on Customer Statements about outstanding balances and Payment Terms
<br>Bank Name: name
<br>Account Number: number
<br>Sort Code: code
<p>A salutation of gratitude for their custom, or some stern warning</p></div>
</div>
Then using the defined classes as selectors within the DOCUMENT.CSS template to define under what circumstances the elements should be displayed:
/*The first selector 'targets' the custom_addText class for all
Document Types, the second 'targets' the original_addText class
for Customer Statements.*/
.custom_addText,
.customerStatement .original_addText {
display: none;
}
/*This displays our custom_addText on Customer Statements
It overrides the above declaration to not display the
custom_text on all Document Types as this is more specific
than the above simple ".custom_addText" selector.*/
.customerStatement .custom_addText {
display: initial;
}
This practise can be applied for other situations across all the Document Types and permits a great means of artistic freedom, permitting almost limitless possibilities.