SwissQrBill.Output.PdfOutput (swiss_qr_bill v0.1.4)

Copy Markdown View Source

Generates the complete Swiss QR bill payment part as PDF. Uses the pdf library. Layout matches the SIX style guide. The QR code is drawn directly as filled rectangles from the QR matrix.

Long values (e.g. a long creditor name or street) are wrapped to the width of their column via Pdf.text_wrap/5, so they never overrun into the QR code (receipt) or off the page edge (payment part). Each information section is laid out against the page cursor: text_wrap advances the cursor to the bottom of the wrapped block, and the next field starts from there. Very long unbreakable tokens are soft-broken so they wrap mid-word instead of overrunning.

Font sizes follow the SIX style guide per section (§3.4): the receipt uses 6 pt headings / 8 pt values, the payment part 8 pt headings / 10 pt values, and the title 11 pt.

Summary

Functions

Generates the payment part as a PDF binary.

Functions

render(bill, opts \\ [])

@spec render(
  map(),
  keyword()
) :: {:ok, binary()} | {:error, String.t()}

Generates the payment part as a PDF binary.

Options

  • :language:de, :fr, :it, :en, or :rm (default: :de)
  • :output_size:payment_slip (default), :a4, or :qr_code
  • :branding — when true, adds a small localized "Created by qrbill.dev" line (default: false). Placement depends on :output_size: above the payment slip (:a4), at the bottom edge of the payment part (:payment_slip), or below the code on a slightly taller canvas (:qr_code).