Maximo Open Forum

 View Only
  • 1.  QR Codes in BIRT

    Posted 03-19-2021 12:24
    Just looking at people's experience with putting QR barcodes into a BIRT report

    There's one thing of putting the plugins into BIRT but also putting it onto the Maximo App server

    With normal 1D barcodes we usually just install the font on the server and that's it

    Thanks
    Chris
    #Reporting

    ------------------------------
    Chris Kung
    SRO Solutions
    ------------------------------


  • 2.  RE: QR Codes in BIRT

    Posted 03-19-2021 14:02
    Edited by Tim Ferrill 03-19-2021 14:07
    Disclaimer: No experience doing this, but now I'm intrigued.

    I think the Java option is the obvious one... If you can get the appropriate classes for something like ZXing you could build the QR image dynamically in BIRT without too much effort.

    The other thing I'm wondering about would be simply embedding an image from an online QR service like QRickit (it looks like you should be able to do this with the Google Charts API as well, but it says it's deprecated and I'm not seeing any recent documentation on actually doing that at the moment). The basic idea is that you send whatever parameters are needed for the QR code in the Image HREF tag and just show that in the report. Obviously you want to make sure you aren't sending any sensitive information this way, but if you're just looking to link to the record or something I'd think that would be safe.

    If I get a chance to play with this I'll let you know what I find.

    ------------------------------
    Tim Ferrill
    Solutions Consultant
    Intelligent Technology Solutions
    tferrill@webuildits.com
    www.webuildits.com
    @tferrill/@webuildits
    ------------------------------



  • 3.  RE: QR Codes in BIRT

    Posted 03-19-2021 16:05
    Edited by Tim Ferrill 03-19-2021 16:10
    Ok, did some real quick testing with this. If you insert an image and build the URI you can use this template:

    "https://qrickit.com/api/qr.php?"
    // Maximo URL (Could potentially link to a specific record)
    + "d=https://maxapp/maximo"
    // Text Label
    + "&addtext=Hello+World"
    // Colors
    + "&txtcolor=000000"
    + "&fgdcolor=000000"
    + "&bgdcolor=FFFFFF"
    // Size
    + "&qrsize=150"
    // Image Format
    + "&t=p"
    // Error Correction
    + "&e=m"​

    And it produces this image (in BIRT designer, but I can't imagine it wouldn't work in Maximo):

    Obviously the QRickit branding isn't ideal, but there are similar services (QuickChart for example) that will give you a cleaner version for a monthly fee.


    ------------------------------
    Tim Ferrill
    Solutions Consultant
    Intelligent Technology Solutions
    tferrill@webuildits.com
    www.webuildits.com
    @tferrill/@webuildits
    ------------------------------



  • 4.  RE: QR Codes in BIRT

    Posted 03-22-2021 12:42
    Edited by Chris Kung 03-22-2021 12:41
    Thanks for the help Tim.

    Much appreciated

    I've tested it and seemed to work. Only issue is when I tried to export the report into PDF and says the resource is not available. Note sure why yet

    ------------------------------
    Chris Kung
    SRO Solutions
    ------------------------------



  • 5.  RE: QR Codes in BIRT

    Posted 03-22-2021 17:03
    Chris, I'm getting the same thing. Of course it couldn't be that easy.

    I'll keep poking around to see if I can find a solution, but I'm coming up empty at the moment.

    ------------------------------
    Tim Ferrill
    Solutions Consultant
    Intelligent Technology Solutions
    tferrill@webuildits.com
    www.webuildits.com
    @tferrill/@webuildits
    ------------------------------



  • 6.  RE: QR Codes in BIRT

    Posted 03-23-2021 09:15
    We hit something similar when we were showing inspection images in the report. I used this blog post as inspiration on how to address it in the report: Eclipse Community Forums: BIRT » Image not showing in PDF

    Essentially, define it as a dynamic image in BIRT and then provide an onRender function to retrieve and set the image contents from your website.

    I hope this helps but if not I'll try and use this exact scenario.

    ------------------------------
    Steven Shull
    Projetech Inc.
    ------------------------------



  • 7.  RE: QR Codes in BIRT

    Posted 03-24-2021 09:36
    Thanks Steven

    The only thing I don't understand is how you grab the image if its an api call?

    Using QuickChart as an example, the url would be:

    https://quickchart.io/qr?text=123&margin=1&size=50

    ------------------------------
    Chris Kung
    SRO Solutions
    ------------------------------



  • 8.  RE: QR Codes in BIRT

    Posted 03-24-2021 09:55
    When I inspected the page, it's a simple HTML page with an image control and the source is of the image is the same URL. IE using that URL, I go and see the image src is https://quickchart.io/qr?text=123&margin=1&size=50. There's no JavaScript or anything on it, so I think you can reference this as the URL and just retrieve the contents of it and it'll be just the image. Using a tool like Postman it's able to retrieve just the image whereas a standard webpage retrieves the full HTML contents. I haven't tested it, but I assume the ImageIO library would be able to handle it. 

    Another option is to use something like idautomation's Java packages. We've had to implement this for code128 fonts in reports before and it wasn't too terrible. It requires adding some files to the Maximo EAR, installing the fonts on the server, and importing their package in their BIRT reports. They have a QR code package, but we've never tried to utilize it.

    ------------------------------
    Steven Shull
    Projetech Inc.
    ------------------------------



  • 9.  RE: QR Codes in BIRT

    Posted 03-24-2021 11:16
    Edited by Chris Kung 03-24-2021 12:30

    I originally got an error but found out I needed the openStream() when passed to the ImageIO

    but looks good so far

    *EDITED* put encodeURI to deal with spaces within the data, so replaces them with %20
    and you need to import the SSL Cert into Websphere.

    This is by no means a permanent solution as its dependant on quickchart but short term you could create pdf files for every storeroom item you currently have and reprint if the labels become damaged.

    importPackage(Packages.java.io);
    importPackage(Packages.java.lang);
    importPackage(Packages.java.net);
    importPackage(Packages.javax.imageio);
    
    
    
    //Image at url
    var myurl = new Packages.java.net.URL("https://quickchart.io/qr?text=" + encodeURI(row["itemnum"]) + "&margin=1&size=50");
    
    var img = ImageIO.read(myurl.openStream());
    var bas = new ByteArrayOutputStream();
    ImageIO.write(img, "png", bas);
    this.data = bas.toByteArray();


    ------------------------------
    Chris Kung
    SRO Solutions
    ------------------------------