Using a Quick Response (QR) code to link to content
A QR code is a type of two-dimensional barcode that contains encoded information. Figure 14-7 shows an example of a QR code.
Figure 14-7  
QR codes are used by a wide range of applications targeted to mobile-phone users. QR codes can store URLs, business card information, or any kind of text. Use a QR code in a report to provide contact information or links to other reports. Mobile-phone users who have a QR code reader on their phone can scan the image of a QR code to display the contact information or open a report.
Actuate BIRT Designer includes a QR code generator, ZXing, for generating QR codes. To insert a QR code in a report, insert an image element to display the QR code. In the image‚Äôs onCreate or onRender event, write code to dynamically create the QR code. Listing 14-1 shows a code example that creates a QR code that when scanned opens a report, qrreport.rptdesign, on an Actuate BIRT iServer.
Listing 14-1  
var size = 350; // image width and height in pixels
var bgnd = new, 1.0, 1.0); // white background
var fgnd = new, 0, 0); // black foreground
// Report URL to encode.
var message = "http://athena:8910/iportal/;"
var writer = new;
var matrix = writer.encode(message,, size, size);
var bi = new, size,;
var g = bi.getGraphics();
for (var y = 0; y < size; y++) {
  for (var x = 0; x < size; x++) {
    if (matrix.get(x, y)) {
      g.fillRect(x, y, 1, 1);
baos = new;
Packages.javax.imageio.ImageIO.write(bi, "png", baos);
QR codes support up to 4,296 characters. The higher the number of characters, the higher the resolution of the QR code. Note, however, that low-resolution mobile phone cameras might not be able to read high-resolution codes.

Additional Links:

Copyright Actuate Corporation 2012