How do I show a qr code in SSRS?
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:
- Obtain existing or compile the two QRCoder assemblies with strong names and the PartiallyTrustedCallers attribute
- Install the two assemblies to the global assembly cache (GAC) using the gacutil.exe utility
- Create a new SSRS report that queries a table of test data
- Add a reference to the QRCoderImageToByteArray GAC assembly
- Add a custom code function that sends a string to the QRCoderImageToByteArray assembly and accepts a byte array in return
- Add a field to the report and increase the physical dimensions of the field to accomodate a larger QR code symbol
- Drag-and-drop an image componenet to the new field to bring up the image properties dialogue
- Change the image source to Database, add a function that references the custom code function and change the MIME type to image/png
- Set the size property of the image component to fill the available field space while maintaining the original aspect ratio
- 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:
And use that code as source for image component:
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.
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, 2022Comments
-
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 about 5 yearsThis 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 about 5 yearsHi 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.