Skip to content

Generate invoice PDF (with calculation)

The "Generate invoice PDF (with calculation)" service task calculates the amounts of an invoice (net, VAT, gross) and renders a PDF from the stored HTML template. It corresponds to Complete e-invoice (calculation + PDF + ZUGFeRD) without the ZUGFeRD part and is used when only an invoice PDF is needed.

Technical name prio_generateInvoicePDF · Category in the backend catalog: Invoices & e-invoicing

Currently not in the 'Select service task' dialog

This service is missing from the "Select service task" dialog of the process designer. It is added to a process via AI process building or MCP (change_process) and keeps running in existing processes. Once the service is part of a process, the PDF settings and the field "PDF target field in invoice (optional)" appear in the properties panel as usual.


When is this service used?

  • Invoice to private customers: Musterfirma GmbH issues training participants a PDF without e-invoice XML.
  • Quote or pro forma invoice: A document with calculated totals that is not meant to be an e-invoice.
  • Draft before approval: The PDF is generated for review and stored under app_invoice_pdf_draft; the e-invoice is created only after approval.

How it works

  1. Calculation: Line totals, VAT and grand totals are added, as in Calculate invoice amounts.
  2. PDF: The HTML template is rendered with Handlebars and produced as an A4 PDF. Options are set in the template via <script id="pdf-options">, header and footer via #pdf-header-template and #pdf-footer-template, carry-overs via data-pantarey-paging, see Generate PDF from template.

Input

Settings in the process designer

The service has the PDF settings in the properties panel with a status card ("PDF ready" / "PDF incomplete").

Setting Required Meaning
Edit PDF template (HTML) Yes Opens the PDF Template Designer (tabs "Template (HTML + Handlebars)", "Sample data (JSON)", preview). Without a template the PDF is empty.
Set filename No Filename with placeholders $(fieldname), e.g. Invoice-$(app_invoice_no).pdf. Empty = document.pdf.
Set data mapping (JSONata) No Expression evaluated against the input; the result is available in the template as content. Empty = the whole input.
PDF target field in invoice (optional) No Field in the invoice object for the PDF reference, e.g. app_invoice_pdf or app_invoice_pdf_draft. Empty = PDF only under pdf.

There is no field mapping for this service; custom schemas are converted to the app_ schema before the step via the input expression. The input expression is prefilled with $, so the activity receives the whole message; if the invoice sits in a sub-field, it is changed to e.g. $.invoice.

Invoice data

Field Type Required Meaning
app_invoice_items_custom list Yes (or app_invoice_items_articles) Line items with app_description, app_amount, app_unit, app_item_price_net, app_vat_percentage (0, 7 or 19), optional app_article_no, app_sublines
all other fields any No passed to the template unchanged, e.g. app_invoice_no, app_invoice_date, app_seller, app_recipient

The calculation knows the same control fields as the complete e-invoice (app_vat_rounding, app_invoice_type, app_partial_invoices, app_skonto_percent, app_tax_mode, app_price_basis), see Calculate invoice amounts.

{
  "app_invoice_no": "RE-2026-0043",
  "app_invoice_date": "2026-11-10",
  "app_recipient": { "document_name": "Bäckerei Huber e. K." },
  "app_invoice_items_custom": [
    { "app_description": "Microsoft 365 training, 1 day", "app_amount": 1, "app_unit": "day", "app_item_price_net": 950, "app_vat_percentage": 19 }
  ]
}

Output

{
  "invoice": {
    "app_invoice_no": "RE-2026-0043",
    "app_net_total": 950.00,
    "app_vat_total": 180.50,
    "app_gross_total": 1130.50,
    "app_amount_due": 1130.50,
    "app_invoice_pdf": { "referenceId": "01JXXXXX", "filename": "Invoice-RE-2026-0043.pdf", "contentType": "application/pdf" }
  },
  "pdf": { "referenceId": "01JXXXXX", "filename": "Invoice-RE-2026-0043.pdf", "contentType": "application/pdf" }
}
  • invoice: the invoice data with the calculated fields (app_net_total, app_vat_total, app_gross_total, app_amount_due, amounts per VAT rate). With PDF target field in invoice the PDF reference is additionally stored under the chosen field.
  • pdf: the generated PDF as file object.

With the result path invoice_result the file is found under invoice_result.pdf, see Result path.


Errors and behavior

  • Errors end the step with an exception: error boundary event or failed instance, see Errors. There is no status/message return value.
  • Typical messages: "calcInvoice: invoice data is missing or invalid" (no line items), "Umsatzsteuer nicht bekannt: …" (VAT rate other than 0, 7 or 19), "Failed to launch the browser after 3 attempts" (PDF rendering).
  • The service has its own retry behavior for the PDF rendering; the central retry for transient errors does not apply. Time limit: 900 seconds.
  • In a dry run the service is not called; a sample output is inserted instead, see Dry run.

Example

Musterfirma GmbH first generates a PDF for review of a training invoice.

  1. Configuration: Set filename → Invoice-$(app_invoice_no).pdf; Edit PDF template (HTML) → invoice template; PDF target field in invoice (optional) → app_invoice_pdf.
  2. Input expression: $ (prefilled); the message is the invoice record from the example above.
  3. Result path: invoice_result.
  4. Output: invoice_result.pdf is the file Invoice-RE-2026-0043.pdf, invoice_result.invoice.app_gross_total is 1130.50.
  5. Next step in the process: A Database step writes invoice_result.invoice to app_invoices; the PDF is thereby stored in the field app_invoice_pdf of the record.

Frequently asked questions

Why can the service not be found in the 'Select service task' dialog?

It is currently missing from the selection list of the process designer. It is added via AI process building or MCP; existing processes keep running unchanged.

When is the complete e-invoice the right choice instead?

As soon as an e-invoice with embedded ZUGFeRD XML is needed. Complete e-invoice (calculation + PDF + ZUGFeRD) uses the same template and the same settings and additionally offers the field mapping.

Which fields are available in the template?

All input fields plus the calculated values such as app_net_total, app_vat_total, app_gross_total; plus all Handlebars helpers such as currency_eur, toGermanDate or qrCode.


Next step

Complete e-invoice (calculation + PDF + ZUGFeRD): the same flow with embedded ZUGFeRD XML.