I just had an interesting support question from a customer, and felt the need to put pen to paper.

They’re finding that regular barcodes are getting too long, so want to switch to using QR Codes for their ID badges. They use Crystal Reports to print the IDs, so need a solution for Crystal Reports. While a User Function Library (UFL) could be used, they’d prefer to avoid the extra work involved in installing the UFL on the PCs and Enterprise Server.

So, the best (only?) option is to use a Web Service and conditionally format an image in Crystal to show the correct QR code.

If you want to do things the hard way, head over to https://google-developers.appspot.com/ and look at the chart API. If you want to do it the easy way, just do this:

  1. First head over to ZXing
  2. Define your base QR Code. It’s easier to edit this later with any custom information in Crystal Reports
  3. Create your Crystal Report
  4. Insert any old image, and make it slightly larger than you want the QR code to appear.
  5. Right click the image and select ‘Format Graphic’
  6. Select the Picture Tab
  7. Click the ‘Custom Format’ (x+2) button next to Graphic Location
  8. Paste in the URL you created in Step 2, put quotation marks around it so that it’s interpreted as a string
  9. Click OK
  10. You now have a static QR code in your report.
  11. Modify the URL you created in 8 so that the QR Code becomes dynamic and includes the information you need.
  12. If you’re having problems, chances are you’ve missed the http:// from the start of the url. Sadly, https isn’t supported.

I must admit, I didn’t realise just how flexible QR codes were until I started this. I’m really impressed!

Sample download: [ddownload id=”4328″]

16 Comments

  1. Erik

    I am unable to get this to work properly. It Previews fine but when I run it in our application it shows the original image.

    Could it be something to do with the Runtime?
    Firewall issue?

    • andrew

      I’m so sorry. Microsoft have changed the security relating to downloads in Sharepoint so many of the download have broken. I’ll send you a link to the download and will modify the download link as soon as possible.

  2. Janice

    Please can I also have the sample code, am having exactly the same issue where the picture shows the picture instead of the QR Code.

      • Janice

        Thank you I could download sample report. My issue is that I want the QR barcode to be dynamic, so I need to set it to a field on my Crystal report. If I do this then the picture shows as the QR code. If I change the graphic location. please help….

        • andrew

          Create a new formula that contains the same as the code for the dynamic image and show that in your report. That should help you see what’s going wrong.
          Don’t forget that it’s http only, not https.

          • Janice

            this is my formula
            {Sheet1_.Item Code}& chr(42) &{Sheet1_.Coil Number}
            I want this to be printed as a qr code on all my labels.

          • andrew

            That doesn’t return a url and has no reference to apis.google.com
            Download the sample, look at the formula in the graphic location and modify that.

          • Janice

            I must be blonde. But this is your code :
            “http://chart.apis.google.com/chart?cht=qr&chs=350×350&chld=L&choe=UTF-8&chl=MECARD%3AN%3AAndrew+Baines%3BORG%3APursuit+Technology%3BTEL%3A01759369827%3BURL%3Awww.pursuittechnology.co.uk%3BEMAIL%3Aandrew.baines%40pursuittechnology.co.uk%3BADR%3AFlat+Top+Cottage+Bishop+Wilton%2C+York%3BNOTE%3AHello!Director%3B%3B”

            from where do I change it to show my formula field : {@Barcode with Pipe}

            Sorry am new to Crystal

          • andrew

            Have you used ZXing to generate a static QR code yet? Once that’s done, you modify the static text with your additional formulae.

          • Janice

            This is what I have from Zxing :
            “http://zxing.org/w/chart?cht=qr&chs=350×350&chld=L&choe=UTF-8&chl=S000669*LCPT+3.0x225x100x20+CQ%0A”

            This scans fine. Now I change it as follows :

            “http://zxing.org/w/chart?cht=qr&chs=350×350&chld=L&choe=UTF-8&chl={@Barcode with Pipe}”
            and the words “Barcode with Pipe” shows when I scan the QR Code.

            Your help will be and is appreciated.

          • andrew

            Try:
            “http://zxing.org/w/chart?cht=qr&chs=350×350&chld=L&choe=UTF-8&chl=” + {@Barcode with Pipe}

            You need the result of the formula in the code, not the name of it.

  3. Archit Shrivastava

    sir i want to generate qr code with dynamic id * 1.5 how i do with this url
    i want to use table.id*1.5 and generate qr code for this data
    like if my id is 8 then 8*1.5 =12 so qr will generated for 12

    • andrew

      Take a look at the sample report.
      Then change the value of the image url by using zxing.org. It’s often easier to use a formula to generate the image url.

Leave a comment