Here is the sample to generate QR Code in AX 2012. This code can be used for report by save the binData.getData() into container field in report temporary table. You can download the xpo here.
public class FormRun extends ObjectRun
{
Microsoft.Dynamics.QRCode.Encoder qrCode;
System.Drawing.Bitmap netBitmap;
BinData binData;
Image image;
}
public void init()
{
super();
qrCode = new Microsoft.Dynamics.QRCode.Encoder();
qrCode.set_Version(40);
qrCode.set_ErrorCorrectionLevel(Microsoft.Dynamics.QRCode.ErrorCorrectionLevel::High); binData = new BinData();
image = new Image();
}
void createQR()
{
Filename filename;
FileIOPermission perm = null;
;
netBitmap = qrCode.Encode(Text.text());
filename = qrCode.GetTempFile(Text.text());
perm = new FileIOPermission(filename, 'RW');
perm.assert();
binData.loadFile(filename);
image.setData(binData.getData());//binData.getData() return a container
QRImage.image(image);
if(WinAPI::fileExists(filename))
{
WinAPI::deleteFile(filename);
}
CodeAccessPermission::revertAssert();
//info(filename);
}
public void textChange()
{
super();
element.createQR();
}