iReport: adding QRCode to Jasper reports the easy way

After testing various complicated solutions to embed a QR Code into iReport Jasper reports, the easiest way I’ve found is this:

1) Put ZXing’s Core and JavaSE jars in the classpath (using Tools/Options/Classpath if compiling locally, or the classpath property if using Ant and net.sf.jasperreports.ant.JRAntCompileTask)

2) Add an image to your report with the following settings:

  • Expression Class:
  • Image Expression :
   , 300, 300))

    Of course, replace $F{CONTENT_TO_ENCODE} with your actual content.

3) Compile the report and enjoy !