How do I show a qr code in SSRS?

11,406

Solution 1

Generate QR Code® barcodes in an SSRS report with the QRCoder library

These are the steps required to create an SSRS report that displays QR code symbols using the QRCoder library:

  1. Obtain existing or compile the two QRCoder assemblies with strong names and the PartiallyTrustedCallers attribute
  2. Install the two assemblies to the global assembly cache (GAC) using the gacutil.exe utility
  3. Create a new SSRS report that queries a table of test data
  4. Add a reference to the QRCoderImageToByteArray GAC assembly
  5. Add a custom code function that sends a string to the QRCoderImageToByteArray assembly and accepts a byte array in return
  6. Add a field to the report and increase the physical dimensions of the field to accomodate a larger QR code symbol
  7. Drag-and-drop an image componenet to the new field to bring up the image properties dialogue
  8. Change the image source to Database, add a function that references the custom code function and change the MIME type to image/png
  9. Set the size property of the image component to fill the available field space while maintaining the original aspect ratio
  10. Execute the report to display the data and the QR code generated from the data

This solution based on QRCoder.

The main points are to register assemblies in GAC, write code calling these assemblies from the report: custom report function

And use that code as source for image component: using component as image source

Solution 2

Here is a CodePlex page with an open source C# QR generator that someone has already implemented in SSRS.

(Follow at the link in the Reviews section for the SSRS implementation.)

I'm sure you could create or find a solution that is easier to integrate, but I don't think you have to start from scratch.

Solution 3

By far the easiest way is to embed an image into your SSRS report. The URL of the image would be (non working example) http://qrcodegen.com&Params=12345

Clearly you would need to choose a reputable company to link to. We use a free service (not my idea) - but even the pay ones are cheap.

In order for this to work, the report server will need access to the site you opt for.

Share:
11,406
Douglas Acosta
Author by

Douglas Acosta

Have been writing and reading code since the nineties. Right now as Business Intelligence manager I have fun with several interesting challenges day by day.

Updated on June 13, 2022

Comments

  • Douglas Acosta
    Douglas Acosta almost 2 years

    I am in the quest to build a report in ssrs/report builder that contains a qr code, is it possible to achieve this?

    I was thinking in implementing a class using c#/vb.net that codes any url/mail address into a QR Code and then import that code into the report to use it.

    What would be your advice?

  • Marc_Sei
    Marc_Sei about 5 years
    This good described solution nearly worked for me, only I did not find the QRCoderImageToByteArray assembly in the latest stable QRCode project downloads. So I created a strong named DLL of the QRCoder.Net40 project, loaded it into the GAC, referenced it from the report and customized the report's (VB) code: basically you need to call the CreateQrCode(...) and QRCode(...) methods and store the result in a bitmap, like in the example of the QRCoder HowTo. If anyone is interested in the whole adjusted code, I will post it.
  • Morgan
    Morgan about 5 years
    Hi Marc - I'm interested in the solution you came up with, I'm doing something similar but used the other project type. Hitting a few walls calling the convert to byte code, SSRS doesn't want to read the class file.