VintaSoft Barcode .NET SDK 15.2: Documentation for .NET developer
Vintasoft.Barcode.SymbologySubsets Namespace / GS1DigitalLinkDataMatrixBarcodeSymbology Class
Members Object Syntax Example Hierarchy Requirements SeeAlso
In This Topic
    GS1DigitalLinkDataMatrixBarcodeSymbology Class
    In This Topic
    Defines the GS1 Digital Link DataMatrix barcode symbology - subset of DataMatrix barcode symbology with values in GS1 Digital Link format.
    Object Model
    BarcodeSymbologySubset GS1DigitalLinkDataMatrixBarcodeSymbology
    Syntax
    'Declaration
    
    Public Class GS1DigitalLinkDataMatrixBarcodeSymbology
       Inherits GS1DigitalLinkBarcodeSymbologySubset
    
    
    public class GS1DigitalLinkDataMatrixBarcodeSymbology : GS1DigitalLinkBarcodeSymbologySubset
    
    
    public __gc class GS1DigitalLinkDataMatrixBarcodeSymbology : public GS1DigitalLinkBarcodeSymbologySubset*
    
    
    public ref class GS1DigitalLinkDataMatrixBarcodeSymbology : public GS1DigitalLinkBarcodeSymbologySubset^
    
    
    Example

    This C#/VB.NET code shows how to generate GS1 Digital Link barcode and read generated barcode.

       
    Imports System.Text   
       
    Imports Vintasoft.Barcode   
    Imports Vintasoft.Barcode.BarcodeInfo   
    Imports Vintasoft.Barcode.SymbologySubsets   
    Imports Vintasoft.Barcode.GS1   
    Imports Vintasoft.Imaging   
       
    ''' <summary>
    ''' Test that shows how to encode the barcode data in GS1 Digital Link format,
    ''' create image with GS1 Digital Link barcode,
    ''' read GS1 Digital Link barcode from image and print data stored in GS1 format.
    ''' </summary>
    Class GS1DigitalLinkExample   
       
        ''' <summary>
        ''' Runs the test (available barcode types QR, DataMatrix).
        ''' </summary>
        Public Shared Sub TestGS1DigitalLink(digitalLinkBarcodeType As BarcodeType)   
            ' GS1 Digital Link barcode
            Dim barcodeSubset As GS1DigitalLinkBarcodeSymbologySubset   
            If digitalLinkBarcodeType = BarcodeType.QR Then   
                barcodeSubset = BarcodeSymbologySubsets.GS1DigitalLinkQR   
            ElseIf digitalLinkBarcodeType = BarcodeType.DataMatrix Then   
                barcodeSubset = BarcodeSymbologySubsets.GS1DigitalLinkDataMatrix   
            Else   
                Throw New NotSupportedException()   
            End If   
       
            ' form the GS1 Application identifiers
            '
            Dim aiValues As GS1ApplicationIdentifierValue() = New GS1ApplicationIdentifierValue(3) {}   
            Dim ai As GS1ApplicationIdentifier   
            ' 01 - Global Trade Item Number
            ai = GS1ApplicationIdentifiers.FindApplicationIdentifier("01")   
            aiValues(0) = New GS1ApplicationIdentifierValue(ai, "0123456789123C")   
            ' 310 - Net weight, kilograms
            ai = GS1ApplicationIdentifiers.FindApplicationIdentifier("310")   
            aiValues(1) = New GS1ApplicationIdentifierValue(ai, "0012.55")   
            ' 30 - Count of Items
            ai = GS1ApplicationIdentifiers.FindApplicationIdentifier("30")   
            aiValues(2) = New GS1ApplicationIdentifierValue(ai, "10")   
            ' 90 - Company Internal Information
            ai = GS1ApplicationIdentifiers.FindApplicationIdentifier("90")   
            aiValues(3) = New GS1ApplicationIdentifierValue(ai, "ABCabc12345")   
            ' create GS1 value item
            Dim gs1DigitalLinkValue As New GS1DigitalLinkValueItem(New GS1DigitalLink("vintasoft.com", aiValues))   
       
            ' create the barcode writer
            Using writer As New BarcodeWriter()   
                ' specify that writer must create output image as 24-bpp image
                writer.Settings.PixelFormat = BarcodeImagePixelFormat.Bgr24   
       
                ' encode GS1 Digital Link barcode
                barcodeSubset.Encode(gs1DigitalLinkValue, writer.Settings)   
       
                ' create image with barcode
                Using barcodeImage As VintasoftBitmap = writer.GetBarcodeAsVintasoftBitmap()   
                    ' delete aiValues array
                    aiValues = Nothing   
       
                    ' read barcode with GS1 value
       
                    ' create barcode reader
                    Using reader As New BarcodeReader()   
                        ' specify that reader must search for GS1 Digital Link barcodes only
       
                        reader.Settings.ScanBarcodeTypes = BarcodeType.None   
                        reader.Settings.ScanBarcodeSubsets.Add(barcodeSubset)   
       
                        ' read barcode from image
                        Dim infos As IBarcodeInfo() = reader.ReadBarcodes(barcodeImage)   
       
                        ' gets GS1 value from barcode value
                        gs1DigitalLinkValue = DirectCast(infos(0).ValueItems(0), GS1DigitalLinkValueItem)   
       
                        ' print barcode type
                        Console.WriteLine("Barcode Type: {0}", infos(0).BarcodeType)   
                        Console.WriteLine()   
       
                        ' print GS1 Digital Link URI value
                        Console.WriteLine("GS1 Digital Link URI:" & vbLf & "{0}", gs1DigitalLinkValue.DigitalLink.DigitalLinkUri)   
                        Console.WriteLine()   
       
                        ' gets a GS1 Application identifiers from barcode value
                        aiValues = gs1DigitalLinkValue.ApplicationIdentifierValues   
       
                        Dim printableValue As New StringBuilder()   
                        ' print Application identifiers values
                        For i As Integer = 0 To aiValues.Length - 1   
                            Dim aiValue As GS1ApplicationIdentifierValue = aiValues(i)   
                            ai = aiValue.ApplicationIdentifier   
                            Console.WriteLine(String.Format("[{0}] {1}", i + 1, aiValue))   
                            Console.WriteLine(String.Format("Application identifier   : {0}", ai.ApplicationIdentifier))   
                            Console.WriteLine(String.Format("Value                    : {0}", aiValue.Value))   
                            Console.WriteLine(String.Format("Data title               : {0}", ai.DataTitle))   
                            Console.WriteLine(String.Format("Data content             : {0}", ai.DataContent))   
                            Console.WriteLine(String.Format("Format                   : {0}", ai.Format))   
                            Console.WriteLine(String.Format("Is contains decimal point: {0}", ai.IsContainsDecimalPoint))   
                            Console.WriteLine(String.Format("Is variable length       : {0}", ai.IsVariableLength))   
                            Console.WriteLine()   
                            printableValue.Append(aiValue.ToString())   
                        Next   
       
                        ' print GS1 printable value
                        Console.WriteLine("Printable GS1 value: " & printableValue.ToString())   
                    End Using   
                End Using   
            End Using   
        End Sub   
    End Class
    
    
    
    using System;
    using System.Text;
    
    using Vintasoft.Barcode;
    using Vintasoft.Barcode.BarcodeInfo;
    using Vintasoft.Barcode.SymbologySubsets;
    using Vintasoft.Barcode.GS1;
    using Vintasoft.Imaging;
    
    /// <summary>
    /// Test that shows how to encode the barcode data in GS1 Digital Link format,
    /// create image with GS1 Digital Link barcode,
    /// read GS1 Digital Link barcode from image and print data stored in GS1 format.
    /// </summary>
    class GS1DigitalLinkExample
    {
    
        /// <summary>
        /// Runs the test (available barcode types QR, DataMatrix).
        /// </summary>
        public static void TestGS1DigitalLink(BarcodeType digitalLinkBarcodeType)
        {
            // GS1 Digital Link barcode
            GS1DigitalLinkBarcodeSymbologySubset barcodeSubset;
            if (digitalLinkBarcodeType == BarcodeType.QR)
                barcodeSubset = BarcodeSymbologySubsets.GS1DigitalLinkQR;
            else if (digitalLinkBarcodeType == BarcodeType.DataMatrix)
                barcodeSubset = BarcodeSymbologySubsets.GS1DigitalLinkDataMatrix;
            else
                throw new NotSupportedException();
    
            // form the GS1 Application identifiers
            //
            GS1ApplicationIdentifierValue[] aiValues = new GS1ApplicationIdentifierValue[4];
            GS1ApplicationIdentifier ai;
            // 01 - Global Trade Item Number
            ai = GS1ApplicationIdentifiers.FindApplicationIdentifier("01");
            aiValues[0] = new GS1ApplicationIdentifierValue(ai, "0123456789123C");
            // 310 - Net weight, kilograms
            ai = GS1ApplicationIdentifiers.FindApplicationIdentifier("310");
            aiValues[1] = new GS1ApplicationIdentifierValue(ai, "0012.55");
            // 30 - Count of Items
            ai = GS1ApplicationIdentifiers.FindApplicationIdentifier("30");
            aiValues[2] = new GS1ApplicationIdentifierValue(ai, "10");
            // 90 - Company Internal Information
            ai = GS1ApplicationIdentifiers.FindApplicationIdentifier("90");
            aiValues[3] = new GS1ApplicationIdentifierValue(ai, "ABCabc12345");
            // create GS1 value item
            GS1DigitalLinkValueItem gs1DigitalLinkValue = new GS1DigitalLinkValueItem(new GS1DigitalLink("vintasoft.com", aiValues));
    
            // create the barcode writer
            using (BarcodeWriter writer = new BarcodeWriter())
            {
                // specify that writer must create output image as 24-bpp image
                writer.Settings.PixelFormat = BarcodeImagePixelFormat.Bgr24;
    
                // encode GS1 Digital Link barcode
                barcodeSubset.Encode(gs1DigitalLinkValue, writer.Settings);
    
                // create image with barcode
                using (VintasoftBitmap barcodeImage = writer.GetBarcodeAsVintasoftBitmap())
                {
                    // delete aiValues array
                    aiValues = null;
    
                    // read barcode with GS1 value
    
                    // create barcode reader
                    using (BarcodeReader reader = new BarcodeReader())
                    {
                        // specify that reader must search for GS1 Digital Link barcodes only
    
                        reader.Settings.ScanBarcodeTypes = BarcodeType.None;
                        reader.Settings.ScanBarcodeSubsets.Add(barcodeSubset);
    
                        // read barcode from image
                        IBarcodeInfo[] infos = reader.ReadBarcodes(barcodeImage);
    
                        // gets GS1 value from barcode value
                        gs1DigitalLinkValue = (GS1DigitalLinkValueItem)(infos[0].ValueItems[0]);
    
                        // print barcode type
                        Console.WriteLine("Barcode Type: {0}", infos[0].BarcodeType);
                        Console.WriteLine();
    
                        // print GS1 Digital Link URI value
                        Console.WriteLine("GS1 Digital Link URI:\n{0}", gs1DigitalLinkValue.DigitalLink.DigitalLinkUri);
                        Console.WriteLine();
    
                        // gets a GS1 Application identifiers from barcode value
                        aiValues = gs1DigitalLinkValue.ApplicationIdentifierValues;
    
                        StringBuilder printableValue = new StringBuilder();
                        // print Application identifiers values
                        for (int i = 0; i < aiValues.Length; i++)
                        {
                            GS1ApplicationIdentifierValue aiValue = aiValues[i];
                            ai = aiValue.ApplicationIdentifier;
                            Console.WriteLine(string.Format("[{0}] {1}", i + 1, aiValue));
                            Console.WriteLine(string.Format("Application identifier   : {0}", ai.ApplicationIdentifier));
                            Console.WriteLine(string.Format("Value                    : {0}", aiValue.Value));
                            Console.WriteLine(string.Format("Data title               : {0}", ai.DataTitle));
                            Console.WriteLine(string.Format("Data content             : {0}", ai.DataContent));
                            Console.WriteLine(string.Format("Format                   : {0}", ai.Format));
                            Console.WriteLine(string.Format("Is contains decimal point: {0}", ai.IsContainsDecimalPoint));
                            Console.WriteLine(string.Format("Is variable length       : {0}", ai.IsVariableLength));
                            Console.WriteLine();
                            printableValue.Append(aiValue.ToString());
                        }
    
                        // print GS1 printable value
                        Console.WriteLine("Printable GS1 value: " + printableValue.ToString());
                    }
                }
            }
        }
    }
    
    

    Inheritance Hierarchy

    System.Object
       Vintasoft.Barcode.BarcodeSymbology
          Vintasoft.Barcode.SymbologySubsets.BarcodeSymbologySubset
             Vintasoft.Barcode.SymbologySubsets.GS1DigitalLinkBarcodeSymbologySubset
                Vintasoft.Barcode.SymbologySubsets.GS1DigitalLinkDataMatrixBarcodeSymbology

    Requirements

    Target Platforms: .NET9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    See Also