import ch.codeblock.qrinvoice.OutputFormat;
import ch.codeblock.qrinvoice.QrInvoiceCodeCreator;
import ch.codeblock.qrinvoice.model.QrInvoice;
import ch.codeblock.qrinvoice.model.builder.QrInvoiceBuilder;
import ch.codeblock.qrinvoice.output.QrCode;
// ..
final QrInvoice qrInvoice = // create using QrInvoiceBuilder;
final QrCode qrCode = QrInvoiceCodeCreator
.create()
.qrInvoice(qrInvoice)
.outputFormat(OutputFormat.PNG)
.desiredQrCodeSize(500)
.createQrCode();
// the resulting byte array contains the Swiss QR Code as PNG
// please note that the size (pixels) varies
final byte[] qrCodeImage = qrCode.getData();
// metadata for the chosen OutputFormat for convenience
final String mimeType = qrCode.getOutputFormat().getMimeType();
final String fileExtension = qrCode.getOutputFormat().getFileExtension();