How to Add QR Code in Jasper Reports (with screenshots)

By | September 19, 2017

How to Add QR Code in Jasper Reports:-  The Very first step is to Download & Install iReport Designer-5.6.0-windows, if not already installed on your PC. WideTechWorld- publish the tutorials for Jasper Reports. To Add a QR Code, we need two jars – ZXing’s Core and JavaSE jars in the classpath in iReport (Jasper).

You can Download the Jars directly from here = Click Here, & save on your PC. We will discuss the steps for adding QR code in your Jasper report. Please share this post with your friend of Facebook, Twitter etc.

Here are the steps for adding QR code in Jasper reports:

Step-1.  Open iReport Designer & add two jars – ZXing’s Core and JavaSE jars in the classpath – (Jasper Report >> Tools >> Options >> Classpath). Now click on “add jar” & select the jar location from your PC. A screenshot is given below.      You can Download the Jars directly from here = Click Here

Step-2.  Now add image to your report with following settings:-

Expression Class: java.awt.Image (as shown below).

Image Expression :

com.google.zxing.client.j2se.MatrixToImageWriter.toBufferedImage(
new com.google.zxing.qrcode.QRCodeWriter().encode(
$F{CONTENT_TO_ENCODE},
com.google.zxing.BarcodeFormat.QR_CODE, 300, 300))

Step-3.  Now Copy & paste above code in Image Expression. Where $F{CONTENT_TO_ENCODE} is the field that you want in your QR code & Enjoy. Run your report & see the preview, a QR code will appear. It will show the details about the report based on the no. of Fields added. A screenshot for this is given below.

 

Note:- WideTechWorld is not the official website for iReport Tutorials, Information published here are taken from various online sources. The information has been published for general use only. Please share this tutorial with your friends on Facebook, Twitter etc.

Leave a Reply