Guide

Page layout

Set paper size and margins, and add headers, footers and "Seite 3 von 12" page numbers to a PDF from the front matter of a template.

On this page

Community

The page block

The page key in the front matter sets up the printed page.

rechnung.md
---
page:
  size: A4
  margin: {top: 45mm, right: 20mm, bottom: 30mm, left: 25mm}
  header:
    first: none
    rest: "{{ section }} · Rechnung {{ rechnung.nummer }}"
  footer:
    left: "{{ firma.name }}"
    center: "Seite {{ page }} von {{ pages }}"
    right: "{{ rechnung.datum | date }}"
---

The keys are listed once, with their values, in the page block reference.

Page numbers

Use {{ page }} and {{ pages }} in a header or footer, as in the example above. All tags are in the page block reference.

Section titles in the header

A long report can show the current chapter at the top of each page. Mark the chapter headings with the class section-title:

<h1 class="section-title">1. Introduction</h1>

Then use {{ section }} in a header. Each page shows the last section title that started on or before it.

Small print

Legal text often needs small type. The class small-print keeps it readable: at least 7 pt, with a line height of 1.2.

<div class="small-print">
  <p>Gerichtsstand ist Frankfurt am Main.</p>
</div>

You can also write @page rules in your own CSS, as in Your first document. The page block is a shorter way to write the common cases.