Sie zeigen eine alte Version dieser Seite an. Zeigen Sie die aktuelle Version an.

Unterschiede anzeigen Seitenhistorie anzeigen

Version 1 Nächste Version anzeigen »

globe with meridians Language: Deutsch · English

hammer and wrench QR code

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

QR code in JasperReports

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.

1. ZXing library

Google provides ZXing. Copy core.jar (folder Core) and javase.jar (folder Javase) into the project folder.

2. QRCode class

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);
 }
 
}

3. Register in Nuclos

Provide the class as a scriptlet/extension and register it in the Jasper classpath parameter.

Customizing the QR code

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.

Related pages

open book DataMatrix


GS1 barcode.

Öffnen →

printer Scriptlets


Scriptlets.

Öffnen →

printer Jasper extensions in Nuclos


Classpath.

Öffnen →

  • Keine Stichwörter