Codeunit 9208 IDA 1D EAN13 Encoder, source in 25
Source242526272829metadata in 25
src/System Application/App/Barcode/src/IDAutomation 1D Provider/Encoders/IDA1DEAN13Encoder.Codeunit.al41 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;
/// <summary>
/// EAN-13 barcode font implementation from IDAutomation
/// from: https://www.barcodefaq.com/barcode-properties/symbologies/ean-13/
/// Is most commonly used to encode 13 digits of the GTIN barcode symbology and also to identify books with Bookland or ISBN barcode symbols.
/// </summary>
codeunit 9208 "IDA 1D EAN13 Encoder" implements "Barcode Font Encoder"
{
Access = Internal;
InherentEntitlements = X;
InherentPermissions = X;
procedure EncodeFont(InputText: Text; var BarcodeEncodeSettings: Record "Barcode Encode Settings"): Text
var
DotNetFontEncoder: DotNet FontEncoder;
begin
DotNetFontEncoder := DotNetFontEncoder.FontEncoder();
exit(DotNetFontEncoder.EAN13(InputText));
end;
procedure IsValidInput(InputText: Text; var BarcodeEncodeSettings: Record "Barcode Encode Settings"): Boolean;
var
RegexPattern: Codeunit Regex;
begin
if InputText = '' then
exit(false);
// match any string containing 12, 13, 15 or 18 digits
exit(RegexPattern.IsMatch(InputText, '^[0-9]{12,13}$|^[0-9]{15}$|^[0-9]{18}$'));
end;
}