PDFApi Invoice Templates

Content

General Information

An invoice template should be made up of two pages:
the first being used as fist page, the second page used for all following pages.

If there is only one page in the template, it is taken for all output pages.

Available Blocknames / Placeholders

Bockname == Invoice Property

Each blockname equals a data field/property of an invoice.

number -> invoice number field
client.number -> realm invoice->client, client number
user.organisation -> realm user, the organisation of the current user
settings.company_info -> realm settings (invoice print settings), field company_info

To access related data you can prefix the blockname with the object type, as seen above.
Available Data/Realms are:

Realm Description
no prefix All direct datafields of the invoice
client the invoice reciever, your client
user the user creating this invoice
company the company the user creating this invoice belongs to
settings the invoice print setting fields

Invoice line items block

Blockname -> line_items

The invoice line items need some special handling, since it is not possible to define a table in a placeholder block.

Some of the blocks normal properties are applied to the table and there is a set of custom properties to further format the output.

All other block properties are not relevant!

General block properties

Those normal block properties will be used:

Property Description
Rect The table will be placed into the rectangle defined by the block outlines.

Text Properties:

Property Description
fontname The font for all text in the table. The font MUST be present as a system font on our server(see debian fonts), if not no text is visible
fontsize The fontsize for all text in the table

Custom block properties

We are serving those as defaults from the system, but you can override them.

If you are redefining those you MUST define the following properties:
  • columns (which columns to show)
  • header (the heading for each column)
Optional
  • align (alignment of the columns contents)
  • width (width of a column)
  • types (the column type)

All custom properties are divided by comma, where the comma defines the column for which the setting will be applied.

Spaces before and after the comma are removed, so you can use them for better readability

my property, my property, my property

setting for column 1, setting for column 2, setting for column 3
Property Type Example Description Available Markup
columns string description,product_name,tax, price_single The columns(in their order) to show in the items table. If empty a set of default columns will be applied. position , quantity , quantity_unit , price_single , description , discount , tax , product_name price_total , price_tax , price_total_with_tax , price_total_without_discount, quantity_with_unit, name_with_description
header string Description,Product,Tax, Single Price The column header texts(in their order). If empty no heading will be shown. Whatever you like to name them. Just remember that commas define the next column header!
width string 20,30,250 The columns width. You can define the width for all or just until a column like 1-3. the remaining column will just take the space they need or get any number
align string left,left,right,right The columns text alignment. You can define the alignment for all or just until a column like 1-3. The default is left alignment right,left,center
types string line,line,text The columns type. if a columns is of type: text it will be rendered as textflow oposed to a single line output. This should only apply to your product description. You should hardly need this setting because every string longer than 20 chars will be treated as textflow line: a simple textline, text: a multiline text

Other special blocks

Page Number

Blockname -> page_number

The page number block shows the page numbers if the invoice has more than one page.
You can customize the text by setting a custom block property named "format"

Property Type Example Description Available Markup
format string Page %number of %total_number Output: Page 2 of 4 %number => the current page numer, %total_number => the number of total pages

Company Logo

Blockname -> company.logo

The logo you uploaded, will be rendered into this block.