How to print a QR code on SSRS report
Nghia Song - Microsoft Dynamics 365 Technical Consultant
Nghia Song
Tel - WhatsApp: +84967324794
Email: songnghia.uit@gmail.com
Nghia Song
Tel - WhatsApp: +84967324794
Email: songnghia.uit@gmail.com
Create QR Code
1. QR code generator creates an image out of the text so you need an image (container) type field on your report data source table.
2. Once you have the field, the generation can be performed with a one-liner.
reportTableTmp.QRCode = new EFDocQRCode_BR().generateQRCode("ELANDAX");
If you don't want to use this class, you can copy the code from inside and use that. Don't forget to use the library.
using Microsoft.Dynamics.ApplicationSuite.QRCode;
try
{
Encoder qrCodeEncoder = new Encoder();
using(System.Drawing.Bitmap bm = qrCodeEncoder.Encode("ELANDAX"))
{
using (var stream = new System.IO.MemoryStream())
{
bm.Save(stream, System.Drawing.Imaging.ImageFormat::Png);
reportTableTmp.QRCode = Binary::constructFromMemoryStream(stream).getContainer();
}
}
}
catch (Exception::CLRError)
{
throw error(CLRInterop::getLastException().ToString());
}
3. The last step is to add an image to an SSRS report.
I recommend setting image's Sizing property to Fit proportional as the generated image is rather small.
Here you go, you have a QR code.
Copied: https://community.dynamics.com/365/financeandoperations/b/elandaxdynamicsaxupgradesanddevelopment/posts/how-to-print-a-qr-code-on-ssrs-report
No comments:
Post a Comment