Skip to content

Invoice PDF Templates ​

Invoice PDFs can use a document template selected globally or on a single invoice. The template controls the invoice HTML that is converted to PDF.

Template Selection ​

PDF generation uses this order:

PrioritySourceNotes
1Invoice pdfDocumentIdExplicit template selected on the invoice
2documents.invoicePdfDocumentIdGlobal invoice PDF template setting
3cfg_invoice_document_idLegacy setting kept for existing customers
4Default invoice templateUsed when no override is selected

Older invoice templates keep working. A legacy template continues to receive the old field names. A template only receives the v1 field set when the document type is invoice and the schema is:

text
renderSchema = invoiceDocument
renderSchemaVersion = 1

Common Fields ​

New invoice templates can use these stable fields:

FieldTypeIncluded
.schemaVersionstringinvoiceDocument.v1
.typestringsale or purchase
.invoiceIdnumberInvoice ID
.invoicePrefixstringInvoice series/prefix
.invoiceNumberstringInvoice number
.invoiceNumber2stringSecondary invoice number
.internalNumberstringInternal document number
.customerReferencestringInvoice customer reference snapshot
.datedate-timeInvoice date
.currencystringCurrency code, for example EUR
.totalExclTaxnumberTotal excluding tax
.totalTaxnumberTax total
.totalInclTaxnumberTotal including tax
.isInvoicePaidbooleanWhether the invoice is paid
.totalDebtnumberRemaining unpaid amount
.totalPaidnumberPaid amount
.dueDatedate-timePayment due date
.paymentTermobjectPayment term
.installmentsarrayPayment installments, when used
.commentstringInvoice comment
.companyobjectBuyer/supplier company details
.billingAddressobjectBilling address snapshot
.shippingAddressobjectShipping address snapshot
.deliveryContactIdnumberDelivery contact reference ID
.ordererContactIdnumberOrderer contact reference ID
.deliveryContactobjectDelivery contact details, when available
.ordererContactobjectOrderer contact details, when available
.related.orderobjectSource order details, when the invoice was created from an order
.orderobjectConvenience alias for .related.order
.lineItemsarrayInvoice lines
.documentChargesarrayDocument-level charges
.settingsobjectInvoice settings
.taxReportingobjectTax reporting flags
.customFieldsobjectTenant-specific custom fields, when configured

Legacy aliases such as .docSeries, .document, .invoiceDate, .totalWithVat, .companyInfo, .products, and .lines are still available for compatibility. Prefer the stable fields above for new templates.

Company Fields ​

Use .company for the buyer/supplier shown on the invoice:

FieldTypeIncluded
.company.namestringCompany/person display name
.company.companyIdnumberCompany ID
.company.registrationNumberstringCompany/registration code
.company.taxNumberstringVAT/tax code
.company.isPersonbooleanTrue when the record is a person
.company.addressstringAddress line
.company.postCodestringPost code
.company.citystringCity
.company.countrystringCountry name
.company.countryCodestringCountry code
.company.phoneNumberstringPhone number

Address And Contact Fields ​

Invoice PDFs should use the invoice snapshot fields, not live address records. Use .billingAddress and .shippingAddress in new templates:

gotemplate
{{ .billingAddress.name }}
{{ .billingAddress.addressLine1 }}
{{ .billingAddress.addressLine2 }}
{{ .billingAddress.city }}
{{ .billingAddress.region }}
{{ .billingAddress.countryName }}
{{ .billingAddress.countryCode }}
{{ .billingAddress.postCode }}
{{ .billingAddress.phone }}

{{ .shippingAddress.name }}
{{ .shippingAddress.addressLine1 }}
{{ .shippingAddress.addressLine2 }}
{{ .shippingAddress.city }}
{{ .shippingAddress.region }}
{{ .shippingAddress.countryName }}
{{ .shippingAddress.countryCode }}
{{ .shippingAddress.postCode }}
{{ .shippingAddress.phone }}

Address fields:

FieldTypeIncluded
.billingAddress.addressIdnumberBilling address reference ID
.billingAddress.namestringBilling address display name
.billingAddress.addressLine1stringBilling address line 1
.billingAddress.addressstringCompatibility alias for addressLine1
.billingAddress.addressLine2stringBilling address line 2
.billingAddress.citystringBilling city
.billingAddress.regionstringBilling region/state/province
.billingAddress.countryNamestringBilling country name resolved from country code when available
.billingAddress.countryCodestringBilling country code
.billingAddress.postCodestringBilling post code
.billingAddress.phonestringBilling address phone
.shippingAddress.addressIdnumberShipping address reference ID
.shippingAddress.namestringShipping address display name
.shippingAddress.addressLine1stringShipping address line 1
.shippingAddress.addressstringCompatibility alias for addressLine1
.shippingAddress.addressLine2stringShipping address line 2
.shippingAddress.citystringShipping city
.shippingAddress.regionstringShipping region/state/province
.shippingAddress.countryNamestringShipping country name resolved from country code when available
.shippingAddress.countryCodestringShipping country code
.shippingAddress.postCodestringShipping post code
.shippingAddress.phonestringShipping address phone

.invoiceAddress and .deliveryAddress are available only as PDF compatibility aliases for .billingAddress and .shippingAddress. Prefer the new names in all new templates.

Contact references and resolved contact objects:

gotemplate
{{ .deliveryContactId }}
{{ .ordererContactId }}

{{ .deliveryContact.firstName }}
{{ .deliveryContact.lastName }}
{{ .deliveryContact.name }}
{{ .deliveryContact.email }}
{{ .deliveryContact.phone }}

{{ .ordererContact.firstName }}
{{ .ordererContact.lastName }}
{{ .ordererContact.name }}
{{ .ordererContact.email }}
{{ .ordererContact.phone }}

Contact fields:

FieldTypeIncluded
.deliveryContact.contactIdnumberDelivery contact ID
.deliveryContact.namestringDelivery contact full name
.deliveryContact.firstNamestringDelivery contact first name
.deliveryContact.lastNamestringDelivery contact last name
.deliveryContact.titlestringDelivery contact title
.deliveryContact.emailstringDelivery contact email
.deliveryContact.phonestringDelivery contact phone
.deliveryContact.phoneNumberstringCompatibility alias for phone
.ordererContact.contactIdnumberOrderer contact ID
.ordererContact.namestringOrderer contact full name
.ordererContact.firstNamestringOrderer contact first name
.ordererContact.lastNamestringOrderer contact last name
.ordererContact.titlestringOrderer contact title
.ordererContact.emailstringOrderer contact email
.ordererContact.phonestringOrderer contact phone
.ordererContact.phoneNumberstringCompatibility alias for phone

If a contact ID is stored but the contact cannot be resolved, the contact object still contains contactId so templates can guard on it.

When an invoice is linked to an order through the order invoiceId, templates can use .related.order. .order is also available as a shorter alias:

gotemplate
{{ with .related.order }}
{{ .documentNumber }}
{{ .orderId }}
{{ .poNumber }}
{{ .customerReference }}
{{ end }}

Related order fields:

FieldTypeIncluded
.related.order.orderIdnumberSource order ID
.related.order.documentstringSource order document number
.related.order.documentNumberstringStable alias for source order document number
.related.order.documentTypestringSource order type
.related.order.typestringAlias for source order type
.related.order.datedate-timeSource order date
.related.order.titlestringSource order title
.related.order.poNumberstringSource order PO number
.related.order.customerReferencestringSource order customer reference
.related.order.externalOrderIdstringSource external order ID
.related.order.shippingMethodNamestringSource order shipping method name
.related.order.shippingMethodSelectorstringSource order shipping method code/selector
.related.order.trackingNumberstringSource order tracking number
.related.order.trackingTypestringSource order tracking carrier/type
.related.order.carrierCodestringSource order carrier code
.related.order.carrierNamestringSource order carrier name
.related.order.carrierServiceCodestringSource order carrier service code
.related.order.carrierServiceNamestringSource order carrier service name

Line Fields ​

Invoice lines are available through .lineItems:

gotemplate
{{ range .lineItems }}
{{ .name }} {{ .quantity }} {{ .measurementUnit }}
{{ formatMoney .priceExclTax $.currency 4 }}
{{ formatMoney .totalInclTax $.currency }}
{{ end }}

.lineItems[]:

FieldTypeIncluded
.lineNonumberLine number
.namestringProduct/service name
.productIdnumberProduct ID
.quantitynumberQuantity
.measurementUnitstringMeasurement unit
.priceExclTaxnumberUnit price excluding tax
.priceInclTaxnumberUnit price including tax
.isPriceInclTaxbooleanWhether source price includes tax
.taxPercentagenumberTax percentage
.taxCodestringTax code
.taxAmountnumberFixed tax amount, when used
.articulestringProduct article/code
.descriptionstringLine description
.lineIdnumberInternal line ID
.discountPerUnitnumberDiscount per unit
.discountPercentnumberDiscount percentage
.totalExclTaxnumberLine total excluding tax
.totalInclTaxnumberLine total including tax
.chargesarrayLine-level charges
.productobjectProduct details, when available

Charge Fields ​

Document charges are in .documentCharges. Line charges are in .lineItems[].charges.

FieldTypeIncluded
.chargeIdnumberApplied charge ID
.chargeTypeIdnumberCharge type ID
.chargeCodestringCharge code
.chargeNamestringCharge name
.calculationTypestringpercentage, fixedAmount, or perUnit
.percentagenumberPercentage value, when used
.baseAmountnumberAmount used as calculation base
.chargeAmountnumberCharge amount excluding tax
.isTaxablebooleanWhether the charge is taxable
.taxPercentagenumberCharge tax percentage
.taxAmountnumberCharge tax amount
.totalAmountnumberCharge amount including tax
.currencystringCurrency code
.remarksstringOptional remarks

Use .chargeId for the applied charge ID.

Seller Configuration ​

Seller/company settings are exposed under .render.configuration.company:

FieldIncluded
.render.configuration.company.nameSeller company name
.render.configuration.company.registrationCodeSeller registration code
.render.configuration.company.vatCodeSeller VAT code
.render.configuration.company.addressSeller address
.render.configuration.company.citySeller city
.render.configuration.company.phoneSeller phone
.render.configuration.company.emailSeller email
.render.configuration.company.websiteSeller website
.render.configuration.company.bankDetailsSeller bank details
.render.configuration.company.logoSeller logo URL

Legacy templates can still use .configuration, but new templates should use the .render.configuration fields.

The total amount in words is available as .render.amountInWords. .render.sumInWords is kept only as a compatibility alias.

Render Helpers ​

The standard template helpers are available:

gotemplate
{{ formatDate .date }}
{{ formatDateLithuanian .date }}
{{ formatDatetimeLithuanian .date }}
{{ formatDateUS .date }}
{{ formatDatetimeUS .date }}
{{ formatDateTimeUS .date }}
{{ formatPrice .totalInclTax }}
{{ formatPrice .priceExclTax 4 }}
{{ formatPrice4 .priceExclTax }}
{{ currencySymbol .currency }}
{{ formatMoney .totalInclTax .currency }}
{{ formatMoney .priceExclTax .currency 4 }}
{{ nl2br .comment }}
{{ T "invoice.total" }}

Date helper output formats:

HelperExample output
formatDate2026-05-26
formatDateLithuanian2026-05-26
formatDatetimeLithuanian2026-05-26 14:30:00
formatDateUS05/26/2026
formatDatetimeUS05/26/2026 02:30 PM
formatDateTimeUS05/26/2026 02:30 PM

formatDate is an alias for formatDateLithuanian. Use formatDateUS when a US-style MM/DD/YYYY date is needed.

Price and currency helpers:

HelperExample
formatPrice .totalInclTax12.35
formatPrice .priceExclTax 412.3456
formatPrice4 .priceExclTax12.3456
formatPriceAbs .totalDebt 4absolute value with 4 decimals
formatPriceSubtract .a .b 4a - b with 4 decimals
currencySymbol "USD"$
currencySymbol "EUR"€
formatMoney 12.3456 "USD"$12.35
formatMoney 12.3456 "EUR"12.35 €
formatMoney 12.3456 "EUR" 412.3456 €

Use formatPrice when the template controls where the currency appears. Use formatMoney when the amount and currency should be rendered together.

Use translation keys through T instead of hard-coded labels when text should be localized.

Versioning ​

invoiceDocument.v1 is stable. Existing v1 fields will not be renamed or removed without a new schema version. Edited legacy templates are not upgraded automatically; they keep their current fields until a user intentionally changes the schema/version in the document UI.

Pikselis Business dokumentacija