This example shows how to create the payment part & receipt (the "payment slip"), which contains the Swiss QR Code as well as the same information as text output. The payment part & receipt is created as a DIN Lang (width: 210mm / height: 105mm) document, which can be placed on a A5 or A4 document positioned in the bottom right corner.

import ch.codeblock.qrinvoice.FontFamily;
import ch.codeblock.qrinvoice.OutputFormat;
import ch.codeblock.qrinvoice.PageSize;
import ch.codeblock.qrinvoice.QrInvoicePaymentPartReceiptCreator;
import ch.codeblock.qrinvoice.model.QrInvoice;
import ch.codeblock.qrinvoice.model.builder.QrInvoiceBuilder;

import java.util.Locale;

// ...

final QrInvoice qrInvoice = // create using QrInvoiceBuilder;

final PaymentPartReceipt paymentPartReceipt = QrInvoicePaymentPartReceiptCreator

// the resulting byte array contains the Swiss QR Code as PDF
final byte[] paymentPartReceiptPdf = paymentPartReceipt.getData();

// meta data for the chosen OutputFormat for convenience
final String mimeType = paymentPartReceipt.getOutputFormat().getMimeType();
final String fileExtension = paymentPartReceipt.getOutputFormat().getFileExtension();

This will generate a PDF containing a payment part & receipt.

Payment Part & Receipt