Skip to content

Page numbers, headers, stamps and watermarks

Page numbers

version: 1
output: out.pdf
inputs: [{file: a.pdf}]
page_numbers:
  - {format: "{n:roman}", pages: toc, count_skipped: false}
  - {format: "Page {n} of {total}", pages: content, count_skipped: false, position: bottom-right}

format can use any token: zero-padded Bates numbers like ABC-{n:06}, roman numerals {n:roman}, the input's own title {input} and page number {input_n}. With count_skipped: false, pages left out of a block do not count, so numbering restarts at start_at.

Headers and footers

version: 1
output: out.pdf
inputs: [{file: a.pdf}]
headers_footers:
  - pages: "2-"
    header:
      left: "${client}"
      right: "{section}"            # the bookmark the page falls under
      rule: true
    footer:
      left: "Confidential\nDo not copy"
      center: "Page {n} of {total}"
    make_room: 3%                   # shrink page content so nothing is covered
  - pages: even                     # mirrored layout: override some slots
    footer:
      left: ""
      right: {image: logo.png, height: 0.25in}

Later blocks override earlier ones slot by slot; "" clears a slot.

Stamps: images, QR codes, barcodes

version: 1
output: out.pdf
inputs: [{file: a.pdf}]
stamps:
  - image: logo.png
    pages: content
    position: top-right
    width: 1in
  - qr: "https://example.com/docs/${project}/page-{n}"
    pages: first
    position: bottom-left
    size: 0.8in
    caption: "Latest version online"
  - barcode: code128                # code128, code39, ean13, datamatrix
    value: "${project}-{n:04}"
    position: bottom-right
    height: 0.3in                   # bar height; width follows from the value

Barcodes are sized by their narrowest bar (bar_width, default 1pt) so they scan reliably when printed. Values are checked (for example EAN-13 check digits), so validate catches bad data.

Watermarks

version: 1
output: out.pdf
inputs: [{file: a.pdf}]
watermarks:
  - text: "DRAFT"                   # diagonal, sized to the page, behind content
  - text: "Copy for ${client}"
    angle: 0
    size: 24
    opacity: 0.3
    layer: over