Dear experts,
I am working on Saudi e-invoicing QR code generation.
To generate QR code, below steps involved
1. Convert Seller, VAT, amounts details to hexadecimal format
2. Create TLV format to converted Hexadecimal values
3. Convert TLV string to Base64
4. Create QR code to Base64
Till step 2 I am able to achieved but converting TLV string to Bse64 I am unable to achieved.
I wrote below code to convert string to Base but not able to achieve desired result:
tlvstR = tlvstr + tlvstr2 +tlvstr3 +tlvstr4 +tlvstr5;
// tlvstr = hex;
// convert string to stream
System.Text.Encoding encodingUTF8;
encodingUTF8 = System.Text.Encoding::get_UTF8();
Byte[] bytes = encodingUTF8.GetBytes(tlvstr);
memoryStream = new System.IO.MemoryStream(bytes);
qrCodeBase64 = System.Convert::ToBase64String(memoryStream.ToArray());
Example:
Lets assume I have TLV value is 010c426f62732
Actual Base64 converted value: NTA2MTcyNjE3MzY4NzU3MjYxNkQ=
Expected Base64 converted value: AQxCB2JZlFJIY29yZHMCDzMxMDEy
Please advice where I am doing mistake and how I should get the expected Base64 values