Codeunit 9224 Dynamics 2D QR-Code Encoder in 24
- App
- System Application
- Namespace
- System.Text
Versions171819202122232425262728latest
Source in 24
src/System Application/App/Barcode/src/Dynamics Barcode Provider/Encoders/Dynamics2DQRCodeEncoder.Codeunit.al47 lines, Copyright (c) Microsoft Corporation. MIT
// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------
namespace System.Text;
using System;
using System.Utilities;
codeunit 9224 "Dynamics 2D QR-Code Encoder" implements "Barcode Image Encoder 2D"
{
Access = Internal;
InherentEntitlements = X;
InherentPermissions = X;
procedure EncodeImage(InputText: Text; BarcodeEncodeSettings2D: Record "Barcode Encode Settings 2D") QRCodeImageTempBlob: Codeunit "Temp Blob"
var
IBarcodeProvider: DotNet "IBarcodeProvider";
QRCodeProvider: DotNet "QRCodeProvider";
QRCodeErrorCorrectionLevel: DotNet "QRCodeErrorCorrectionLevel";
QRCodeOutStream: OutStream;
CannotCreateQrCodeErr: Label 'QR Code could not be created.';
begin
QRCodeImageTempBlob.CreateOutStream(QRCodeOutStream);
IBarcodeProvider := QRCodeProvider.QRCodeProvider();
GetErrorCorrectionLevelFromEnum(QRCodeErrorCorrectionLevel, BarcodeEncodeSettings2D);
if not IBarcodeProvider.GetBarcodeStream(InputText, QRCodeOutStream, QRCodeErrorCorrectionLevel,
BarcodeEncodeSettings2D."Module Size", BarcodeEncodeSettings2D."Quite Zone Width", BarcodeEncodeSettings2D."Code Page")
then
Error(CannotCreateQrCodeErr);
end;
local procedure GetErrorCorrectionLevelFromEnum(var QRCodeErrorCorrectionLevel: DotNet "QRCodeErrorCorrectionLevel"; BarcodeEncodeSettings2D: Record "Barcode Encode Settings 2D")
begin
case BarcodeEncodeSettings2D."Error Correction Level" of
BarcodeEncodeSettings2D."Error Correction Level"::High:
QRCodeErrorCorrectionLevel := QRCodeErrorCorrectionLevel::High;
BarcodeEncodeSettings2D."Error Correction Level"::Medium:
QRCodeErrorCorrectionLevel := QRCodeErrorCorrectionLevel::Medium;
BarcodeEncodeSettings2D."Error Correction Level"::Low:
QRCodeErrorCorrectionLevel := QRCodeErrorCorrectionLevel::Low;
BarcodeEncodeSettings2D."Error Correction Level"::Quartile:
QRCodeErrorCorrectionLevel := QRCodeErrorCorrectionLevel::Quartile;
end;
end;
}Procedures, 1
| Name | Parameters | Returns | Access | Obsolete |
|---|---|---|---|---|
| EncodeImage | (Text, Record Barcode Encode Settings 2D) | Codeunit Temp Blob | public | - |