Monsieur Winner

MS D365FO || Monsieur D365FO

Technical

Generate QR Code in Microsoft AX 2012

A quick way of generating a QR code from Microsoft Dynamics AX 2012.

In this tutorial, I am making use of AX 2012 R3.

A palpable example is printing a QR code for an Item.

Here is a simple job that would generate the phrase “Bonjour Monsieur Winner” as a QR code.

static void createQRCode(Args _args)
{

Microsoft.Dynamics.QRCode.Encoder qrCode;
System.String netString;
str tempFileName;
System.Drawing.Bitmap netBitmap;
Bitmap imageQR;
FileIOPermission perm;
BinData binData;
container imageContainer;
Image image;
;

netString = “Bonjour Monsieur Winner”;
qrCode = new Microsoft.Dynamics.QRCode.Encoder();
netBitmap = qrCode.Encode(netString); //encode the string as Bitmap can be used already

tempFileName = qrCode.GetTempFile(netString); //to get the QR temporary file

perm = new FileIOPermission(tempFileName,’r’);
perm.assert();
binData = new binData();
binData.loadFile(tempFileName);
imageContainer = binData.getData(); //get the QR code image put inside container so can be stored inside database for storing or reporting purpose

System.IO.File::Delete(tempFileName);

CodeAccessPermission::revertAssert();

// Saving the QR code as a PNG file
image = new Image();
image.setData(imageContainer);

image.saveImage(“D:\Monsieur.png”, ImageSaveType::PNG);
}

 

 

Merci 🙂

admin

Komi Siabi is a Bilingual D365FO Solution architect who loves sharing his knowledge as he works on Both Francophone and Anglophone projects around the globe. He enjoys doing some tiktok videos in his leisure time.

0 thoughts on “Generate QR Code in Microsoft AX 2012

  • Your comment is awaiting moderation.

    you have a great blog right here! would you like to make some invite posts on my weblog?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *