Versionen im Vergleich

Schlüssel

  • Diese Zeile wurde hinzugefügt.
  • Diese Zeile wurde entfernt.
  • Formatierung wurde geändert.
Auszug
hiddentrue

Nuclos Jasper QR code: ZXing, QRCodeWriter, core.jar, javase.jar, image expression, classpath, barcode.

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.

Status
colourPurple
titleHow-to
Status
colourBlue
titleApplication developer
Status
colourGreen
titleUpdated: Jul 2026
Status
colourGrey
titleapplies to Nuclos 4.2026.x

Panel
bgColor#F4F5F7

On this page

Inhalt
maxLevel2
minLevel2

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

Codeblock
languagejava
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 +):

Codeblock
languagejava
"LS: " + $F{strnummer}
Info
titleData 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.

Open →

printer Scriptlets


Scriptlets.

Open →

printer Jasper extensions in Nuclos


Classpath.

Open →