Skip to content

Jinja2PDF

German quote (Angebot) with optional items

A quote in the German letter layout: optional positions are listed but stay out of the sum, the discount and VAT are computed in the template, and the validity date follows from the quote date. The footer carries the company details German law expects on business letters.

Free plan, no card. You get your own copy in the editor, published and ready for the API.

Rendered result

Rendered result: German quote (Angebot) with optional items
PDF · 1 page · 101 KB ↓ download

What this example shows

  • where('optional', false) keeps optional positions out of the sum while the table still lists them, marked as optional.
  • Discount and VAT are arithmetic in the template: 5 % off 17.100,00 €, then 19 % VAT, gives the 19.331,55 € on the page.
  • dateAdd(quote.valid_days, 'days') turns the quote date into “Gültig bis 15.10.2026”; the number of days comes from the data.
  • The footer is a Chromium footer template with register court, managing director, VAT ID and bank details, plus pageNumber and totalPages.
  • .lines tr { break-inside: avoid } keeps a position from being cut in half when a long quote runs onto a second page.

Helpers used

Template folder

templates/angebot/template.htmlJinja2
<p class="sender">{{ company.name }} · {{ company.street }} · {{ company.city }}</p>
<address class="recipient">
  <strong>{{ customer.name }}</strong><br>
  {{ customer.contact }}<br>
  {{ customer.street }}<br>
  {{ customer.city }}
</address>
<table class="facts">
  <tr><td>Angebot</td><td>{{ quote.number }}</td></tr>
  <tr><td>Datum</td><td>{{ quote.date | date('dd.MM.yyyy') }}</td></tr>
  <tr><td>Gültig bis</td><td>{{ quote.date | dateAdd(quote.valid_days, 'days') | date('dd.MM.yyyy') }}</td></tr>
  <tr><td>Kundennummer</td><td>{{ customer.number }}</td></tr>
</table>

<h1>Angebot {{ quote.number }}</h1>
<p>Guten Tag {{ customer.contact }},<br>vielen Dank für Ihre Anfrage. Gern bieten wir Ihnen an:</p>

<table class="lines">
  <thead>
    <tr><th>Pos.</th><th>Leistung</th><th class="num">Menge</th><th class="num">Einzelpreis</th><th class="num">Gesamt</th></tr>
  </thead>
  <tbody>
    {% for line in quote.lines %}
    <tr>
      <td>{{ loop.index }}</td>
      <td>{{ line.description }}{% if line.optional %} <span class="muted">(optional, nicht in der Summe)</span>{% endif %}</td>
      <td class="num">{{ line.qty | number(0) }} {{ line.unit }}</td>
      <td class="num">{{ line.price | money }}</td>
      <td class="num">{{ line.total | money }}</td>
    </tr>
    {% endfor %}
  </tbody>
</table>

{% set net = quote.lines | where('optional', false) | sum('total') %}
{% set discount = net * quote.discount_percent / 100 %}
{% set vat = (net - discount) * quote.vat_rate / 100 %}
<table class="totals">
  <tr><td>Zwischensumme</td><td class="num">{{ net | money }}</td></tr>
  <tr><td>Rabatt {{ quote.discount_percent }} %</td><td class="num">−{{ discount | money }}</td></tr>
  <tr><td>USt. {{ quote.vat_rate }} %</td><td class="num">{{ vat | money }}</td></tr>
  <tr class="grand"><td>Angebotssumme</td><td class="num">{{ (net - discount + vat) | money }}</td></tr>
</table>

<p>{{ quote.terms }}</p>
<p>Mit freundlichen Grüßen<br>{{ company.director }}</p>
templates/angebot/style.cssCSS
body { font-family: 'Inter', sans-serif; font-size: 9.5pt; line-height: 1.45; color: #1e293b; }
.sender {
  display: inline-block;
  margin: 10mm 0 3mm;
  padding-bottom: 1mm;
  border-bottom: 1px solid #cbd5e1;
  font-size: 7pt;
  color: #64748b;
}
.recipient { min-height: 27mm; font-style: normal; line-height: 1.5; }
.facts { float: right; margin-top: -27mm; font-size: 8.5pt; color: #475569; }
.facts td { padding: 0.4mm 0 0.4mm 5mm; }
.facts td:last-child { text-align: right; color: #1e293b; }
h1 { clear: both; margin: 14mm 0 4mm; font-size: 16pt; color: #312e81; }
table.lines { width: 100%; margin-top: 6mm; border-collapse: collapse; }
.lines th {
  padding: 2mm 1.5mm;
  border-bottom: 1.5px solid #1e293b;
  text-align: left;
  font-size: 7.5pt;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #64748b;
}
.lines td { padding: 2.3mm 1.5mm; border-bottom: 1px solid #e2e8f0; vertical-align: top; }
.lines tr { break-inside: avoid; }
.num { text-align: right !important; white-space: nowrap; }
.totals { width: 78mm; margin: 5mm 0 0 auto; border-collapse: collapse; break-inside: avoid; }
.totals td { padding: 1.2mm 1.5mm; }
.totals .grand td { border-top: 1.5px solid #1e293b; font-weight: 700; font-size: 11pt; }
.muted { color: #64748b; }
templates/angebot/head.htmlHTML
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap">
templates/angebot/footer.htmlJinja2
<div style="box-sizing:border-box;width:100%;display:flex;justify-content:space-between;gap:6mm;padding:0 18mm;font-size:7px;line-height:1.5;color:#555">
  <span>{{ company.name }} · {{ company.street }} · {{ company.city }}<br>{{ company.register }} · Geschäftsführung: {{ company.director }}</span>
  <span>USt-IdNr. {{ company.vat_id }}<br>IBAN {{ company.iban }} · BIC {{ company.bic }}</span>
  <span style="white-space:nowrap">Seite <span class="pageNumber"></span> von <span class="totalPages"></span></span>
</div>
templates/angebot/settings.jsonJSON
{
  "paper": {
    "format": "A4"
  },
  "margin": {
    "top": "20mm",
    "right": "18mm",
    "bottom": "26mm",
    "left": "22mm"
  },
  "locale": "de-DE",
  "timezone": "Europe/Berlin",
  "currency": "EUR",
  "pdf": {
    "metadata": {
      "title": "Angebot {{ quote.number }}"
    }
  },
  "footer": {
    "height": "16mm"
  }
}
templates/angebot/data/default.jsonJSON
{
  "company": {
    "name": "Fennlor Studio GmbH",
    "street": "Musterstraße 1",
    "city": "12345 Musterstadt",
    "phone": "+49 000 0000000",
    "email": "hallo@fennlor.example",
    "iban": "DE36000000000000000000",
    "bic": "XXXXDEXXXXX",
    "vat_id": "DE000000000",
    "register": "Amtsgericht Musterstadt, HRB 00000",
    "director": "Erika Mustermann"
  },
  "customer": {
    "name": "Olvarest GmbH",
    "contact": "Max Mustermann",
    "street": "Beispielweg 2",
    "city": "54321 Beispielstadt",
    "number": "K-10482"
  },
  "quote": {
    "number": "AN-2026-031",
    "date": "2026-09-15",
    "valid_days": 30,
    "discount_percent": 5,
    "vat_rate": 19,
    "terms": "Zahlbar 14 Tage nach Rechnungsstellung ohne Abzug. Die Umsetzung beginnt zwei Wochen nach Auftragserteilung.",
    "lines": [
      {
        "description": "Konzeption und Workshop",
        "qty": 2,
        "unit": "Tage",
        "price": 1200,
        "total": 2400,
        "optional": false
      },
      {
        "description": "Umsetzung Kundenportal",
        "qty": 15,
        "unit": "Tage",
        "price": 980,
        "total": 14700,
        "optional": false
      },
      {
        "description": "Wartungsvertrag, 12 Monate",
        "qty": 12,
        "unit": "Monate",
        "price": 240,
        "total": 2880,
        "optional": true
      }
    ]
  }
}

Render it through the API

Save the sample data as data.json and send it with the template’s name. Each language uses its SDK; curl sends the same JSON to the REST API, as any other language can. Renders with a key that starts with ff_test_ are not metered; on the Free plan they carry a small watermark.

render.shShell
jq '{template: "angebot", data: ., filename: "angebot-AN-2026-031.pdf"}' data.json \
  | curl https://api-eu.formfeed.dev/v1/renders \
      -H "Authorization: Bearer ff_test_..." \
      -H "Content-Type: application/json" \
      --data-binary @-
render.tsTypeScript
import { Formfeed } from '@formfeed/sdk';
import data from './data.json' with { type: 'json' };

const formfeed = new Formfeed({ apiKey: process.env.FORMFEED_API_KEY! });

const render = await formfeed.renders.create({
  template: 'angebot',
  data,
  filename: 'angebot-AN-2026-031.pdf',
});
console.log(render.status, render.download_url);
render.pyPython
import json
import os

from formfeed import Formfeed

formfeed = Formfeed(api_key=os.environ["FORMFEED_API_KEY"])

with open("data.json", encoding="utf-8") as file:
    data = json.load(file)

render = formfeed.renders.create(
    template="angebot",
    data=data,
    filename="angebot-AN-2026-031.pdf",
)
print(render.status, render.download_url)
render.phpPHP
<?php
require __DIR__ . '/vendor/autoload.php';

$formfeed = new Formfeed\Client(apiKey: getenv('FORMFEED_API_KEY'));

$render = $formfeed->renders->create([
    'template' => 'angebot',
    'data' => json_decode(file_get_contents('data.json'), true),
    'filename' => 'angebot-AN-2026-031.pdf',
]);
echo $render->status, ' ', $render->downloadUrl, PHP_EOL;
main.goGo
package main

import (
	"context"
	"encoding/json"
	"fmt"
	"log"
	"os"

	formfeed "github.com/formfeed-dev/formfeed-go"
)

func main() {
	client := formfeed.NewClient(os.Getenv("FORMFEED_API_KEY"))

	contents, err := os.ReadFile("data.json")
	if err != nil {
		log.Fatal(err)
	}
	var data map[string]any
	if err := json.Unmarshal(contents, &data); err != nil {
		log.Fatal(err)
	}

	render, err := client.Renders.Create(context.Background(), formfeed.RenderRequest{
		Template: "angebot",
		Data:     data,
		Filename: "angebot-AN-2026-031.pdf",
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(render.Status, render.DownloadURL)
}
Program.csC#
using System.Text.Json;
using Formfeed;

using var formfeed = new FormfeedClient(Environment.GetEnvironmentVariable("FORMFEED_API_KEY"));

var render = await formfeed.Renders.CreateAsync(new RenderRequest
{
    Template = "angebot",
    Data = JsonSerializer.Deserialize<Dictionary<string, object?>>(File.ReadAllText("data.json")),
    Filename = "angebot-AN-2026-031.pdf",
});
Console.WriteLine($"{render.Status} {render.DownloadUrl}");
Render.javaJava
import com.fasterxml.jackson.databind.ObjectMapper;
import dev.formfeed.Formfeed;
import dev.formfeed.RenderRequest;
import java.io.File;

public class Render {
  public static void main(String[] args) throws Exception {
    var formfeed = Formfeed.builder().apiKey(System.getenv("FORMFEED_API_KEY")).build();
    var data = new ObjectMapper().readTree(new File("data.json"));

    var request = RenderRequest.template("angebot")
        .data(data)
        .filename("angebot-AN-2026-031.pdf");
    var render = formfeed.renders().create(request);
    System.out.println(render.getStatus() + " " + render.getDownloadUrl());
  }
}
render.rbRuby
require "json"
require "formfeed"

formfeed = Formfeed::Client.new(api_key: ENV.fetch("FORMFEED_API_KEY"))

render = formfeed.renders.create(
  template: "angebot",
  data: JSON.parse(File.read("data.json")),
  filename: "angebot-AN-2026-031.pdf"
)
puts "#{render.status} #{render.download_url}"

Start rendering today

The free plan includes 100 units a month and free test renders. Change plans when you need more.