Sunday, 20 March 2022

Print QR Code in PaySlip with LS Retail NAV 2016

 I found one of the the method and DLL file which is being used in below code to generate the particular width and height of the QR code in Pay slip.

Note: please check your thermal or Zebra printer setting to print QR code image.


Declarations of Variables

Name DataType Subtype Length

EncodingOption DotNet ZXing.Common.EncodingOptions.'zxing, Version=0.16.6.0, Culture=neutral, PublicKeyToken=830ae994e36ac27d'

BarcodeWriter DotNet ZXing.BarcodeWriter.'zxing, Version=0.16.6.0, Culture=neutral, PublicKeyToken=830ae994e36ac27d'

Barcodeformat DotNet ZXing.BarcodeFormat.'zxing, Version=0.16.6.0, Culture=neutral, PublicKeyToken=830ae994e36ac27d'

BitMatrix DotNet ZXing.Common.BitMatrix.'zxing, Version=0.16.6.0, Culture=neutral, PublicKeyToken=830ae994e36ac27d'

QrCodeBitmap DotNet System.Drawing.Bitmap.'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

ImageFormat DotNet System.Drawing.Imaging.ImageFormat.'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

Zing DLL download here.

LOCAL GenerateQRCode(TexttoQR : Text) QRPath : Text

      EncodingOption := EncodingOption.EncodingOptions();

      EncodingOption.Height := 200;

      EncodingOption.Width := 200;


      BarcodeWriter := BarcodeWriter.BarcodeWriter();

      BarcodeWriter.Format := Barcodeformat.QR_CODE;

      BarcodeWriter.Options := EncodingOption;

      BitMatrix := BarcodeWriter.Encode(TexttoQR);

      QrCodeBitmap := BarcodeWriter.Write(BitMatrix);


      ServerFileName:=COPYSTR(FileManagement.ServerTempFileName(BmpFormat),1,250);

      QrCodeBitmap.Save(ServerFileName, ImageFormat.Bmp);

      ClientFileName:=FileManagement.ClientTempFileName('');

      FileManagement.DownloadToFile(ServerFileName,ClientFileName);


      FileManagement.BLOBImport(TempBlob,ClientFileName);


      FileManagement.BLOBImportFromServerFile(TempBlob, ClientFileName);

      QRPath := FileManagement.BLOBExport(TempBlob, 'InvQrCode.jpg',FALSE);

      EXIT(QRPath);

2 comments:

  1. Hi Sir , i hope you are doing well can you share the detail method how to install or get dotnet library on AL

    ReplyDelete
  2. Hi Wajahat, It was done in NAV 2016, not in AL so you might be you need to use some Azure function to achive that in AL- www.navwitnav.com

    ReplyDelete

Extension Unpublished/Uninstalled history required in BC Production environment

  There is a situation when someone can uninstall or unpublish any APP extension from the extension management in Production environment, th...