- QR code on a report in AX 2009.
In order to do this,
1.Create a new display method on the report. The below code can be used to generate QR code.
display container qrcode()
{
Bindata bindata = new Bindata();
Image Imgobj;
System.Drawing.Image img;
System.Drawing.Bitmap obj;
Filepath sourcePath;
container con;
InteropPermission interopPerm;
FileIoPermission _perm;
Microsoft.Dynamics.QRCode.Encoder encoder;
System.Exception ex;
Set permissionSet;
;
sourcePath = @"C:\temp\newQRCode.bmp";
permissionSet = new Set(Types::Class);
permissionSet.add(new FileIOPermission(sourcePath,'rw'));
permissionSet.add(new InteropPermission(InteropKind::ClrInterop));
CodeAccessPermission::assertMultiple(permissionSet);
encoder = new Microsoft.Dynamics.QRCode.Encoder();
obj = new System.Drawing.Bitmap(encoder.Encode("SYED IRFAN QR CODE TEST"));
obj.Save(sourcePath,System.Drawing.Imaging.ImageFormat::get_Bmp());
bindata.loadFile(sourcePath);
con = bindata.getData();
return con;
}
2.Add the image control on the report based on the display method.
3.QR code can be seen on the report on running it.
1.Create a new display method on the report. The below code can be used to generate Barcode .
display BarCodeString barCode()
{
Barcode barcode;
;
barcode = Barcode::construct(BarcodeType::Code39);
barcode.
string
(
true
, "SYED IRFAN BARCODE TEST");
barcode.encode();
return
barcode.barcodeStr();
}
3.Run the report and send the output to the screen.