How do I show a qr code in SSRS?
Asked Answered
E

5

5

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?

Extract answered 23/4, 2016 at 13:25 Comment(0)
R
5

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

Razid answered 18/12, 2018 at 14:36 Comment(2)
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.Ignominious
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.Washbowl
U
3

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.

Urumchi answered 23/4, 2016 at 15:6 Comment(0)
P
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.

Posh answered 25/4, 2016 at 8:1 Comment(0)
L
1

There is a free API that can be used to generate QR code images. To use it in a report, follow these steps:

  1. Insert a new image in your report.
  2. For the "Select the image source" option, select External.
  3. Hit the function button by the Use this image control.
  4. Enter a function the returns a URL that looks like this:

https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=https://PutInYourURLHere.com

Lester answered 28/11, 2022 at 15:26 Comment(0)
R
0

The same answer can be found here: https://www.sqlservercentral.com/articles/generate-qr-code-barcodes-in-an-ssrs-report-with-the-qrcoder-library

But at the bottom is a zip file with qrcoderimagetobytearray.dll as well as qrcoder.dll. While the NuGet download only has qrcoder.dll.

Rouge answered 26/10, 2023 at 18:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.