Language: Deutsch · English
Generate QR codes in reports – ZXing library, QRCode class, classpath and free customization of the image expression.
HOW-TO APPLICATION DEVELOPER STAND: JUL 2026 GILT FUER NUCLOS 4.2026.X
Auf dieser Seite
A QR code is a 2D matrix with error correction (up to ~30% loss). In Nuclos forms it is generated via the ZXing library and a small helper class.
Google provides ZXing. Copy core.jar (folder Core) and javase.jar (folder Javase) into the project folder.
package com.qrcodeself;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.WriterException;
import com.google.zxing.client.j2se.MatrixToImageWriter;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.QRCodeWriter;
/**
*
* @author
*/
public class QRCodeClass{
public static java.awt.Image setQRCode(String code) {
QRCodeWriter writer = new QRCodeWriter();
BitMatrix matrix = null;
try {
matrix = writer.encode(code, BarcodeFormat.QR_CODE, 100, 100);
}catch (WriterException e){
}
return MatrixToImageWriter.toBufferedImage(matrix);
}
}
Provide the class as a scriptlet/extension and register it in the Jasper classpath parameter.
Every base form contains a default QR code from the BO's abbreviation and number. The call is in the Image Expression property and can be composed freely (string concatenation with +):
"LS: " + $F{strnummer}
Data types
String fields are recognizable by the str prefix. Convert other types (dbl, int, bln, BigDecimal) first, e.g. $F{dblvknetto}.toString() or formatted new java.text.DecimalFormat("#,##0.00").format($F{dblvknetto}).
Extended QR code values.