D365 FO : Printing & Generate QR code in SSRS Report

Requirement – PRINTING & GENERATE QR CODE IN SSRS REPORT USING MICROSOFT.DYNAMICS.QRCODE.ENCODER & X++ in Microsoft Dynamics 365 finance and operations.

Sample Code

  • Your QR Code base64 string should look value as mentioned below
  • Add a Container field in your temp table of your SSRS report .
  • Write below X++ code in PROCESS method of DP (Data provider) class of your SSRS report in Microsoft Dynamics 365 finance and operations. ‘Microsoft.Dynamics.QRCode.Encoder’ has been used  , to encode the string into an image.
public void ProcessReport()
{
    str QrCodeBase64String = 'your QR Code base';
    Microsoft.Dynamics.QRCode.Encoder   qrCode;
    System.String                       netString;
    str                                 tempFileName;
    System.Drawing.Bitmap               netBitmap;
    Bitmap                              imageQR;
    FileIOPermission    perm;   
    BinData             binData;
    container           imageContainer;   
    ;
    
 
    acxTmpQRTable.clear();
    acxTmpQRTable.initValue();
    qrCode = new Microsoft.Dynamics.QRCode.Encoder();   
    netBitmap = qrCode.Encode(acxQRTable.QRCode);   
    //encode the string as Bitmap can be used already
    binData = new binData();
    tempFileName    =      
    qrCode.GetTempFile(QrCodeBase64String);
    perm  = new FileIOPermission(tempFileName,     
     'RW');
    perm.assert();
    binData.loadFile(tempFileName);
    imageContainer = binData.getData(); 
    acxTmpQRTable.QRImage = imageContainer;
    acxTmpQRTable.insert();
}

Leave a Reply