How to use a QR code in a SSRS report

Prerequisites

Before configuring your SSRS report to display QR codes, it is necessary to install the required components on the computer running the Report Server:

  • Download the latest version of QuidSetups
  • Extract locally
  • Execute QuidSetups.exe
  • Follow the steps:
    • In "Type of installation" select Custom
    • In "Type of machine" select Server
    • Ensure Server > Other > Relatórios > Reporting Services > QRCoder is checked (you may uncheck all the other boxes)
    • Click Install
  • Restart the Report Server for it to detect the newly added assembly

Configuration

Assuming the required assemblies were correctly installed into the global assembly cache (GAC), it is necessary to set the reference to the assembly on the RDL (Report Definition Language). Using Microsoft Report Builder:

  • Open Report Properties by right-clicking outside the body of the report
  • Navigate to "References" tab
  • Under "Add or remove assemblies", click "Add"
  • Click the button to browse and select the component (QuidgestQRCoder.dll, should be located at %WINDIR%\assembly\GAC_MSIL\QuidgestQRCoder)

Usage

Once the necessary configuration is in place, converting a text field to a QR code representation is very simple:

  • Add an image to the report
  • Open Image Properties by right-clicking on it
  • Under "Use this field", click on the button
  • Set the expression value (e.g., the expression =QuidgestQRCoder.QRCode.StringToQRcode(Fields!NAME.Value) converts the text field NAME to a QR code representation)

Note that this guide assumes that the necessary Data Sources and Datasets are already configured in order to access the desired text fields.

Discussion

We found that there are multiple ways to display a QR code in a SSRS report. We believe that the method described in this guide is the most flexible of all, as it enables to quickly convert simple text fields to their correspoding QR code representation. However, there are some alternative ways:

  • Network request to get the QR code representation. It is possible to obtain the QR code representation (in bytes) of a given text field by sending a network request to a listening endpoint that offers this service. This method does not require the prerequisites described in this guide. However, it does require the endpoint to be accessible by the Report Server machine, which might not always be possible. Additionally, this method requires a more difficult configuration step, not described in this guide.
  • Database contains an image field with the QR code representation. Assuming the dataset already contains an image field with the desired QR code representation, the prerequisite and configuration steps described in this guide are no longer necessary, since displaying an image field is natively supported by SSRS. However, having multiple database fields that contain the same information (simply represented in different ways) is an additional cost that requires analysis.