VintaSoft Barcode .NET SDK 16.0: Documentation for .NET developer
Vintasoft.Barcode.BarcodeInfo Namespace / MailmarkCmdmValueItem Class
Members Object Syntax Example Hierarchy Requirements SeeAlso
In This Topic
MailmarkCmdmValueItem Class
In This Topic
Contains information about a decoded value of Mailmark CMDM 2D barcode.
Object Model
MailmarkCmdmValueItem
Syntax
'Declaration

Public Class MailmarkCmdmValueItem
   Inherits ValueItemBase

public class MailmarkCmdmValueItem : ValueItemBase

Example

Here is a simple example that demonstrates how to generate Mailmark CMDM 2D barcode:

   
   
Imports Vintasoft.Barcode   
Imports Vintasoft.Barcode.BarcodeInfo   
Imports Vintasoft.Barcode.SymbologySubsets   
Imports Vintasoft.Imaging   
   
''' <summary>
''' Test that demonstrates how to generate an image with Mailmark CMDM Type29 barcode and
''' how to recognize Mailmark CMDM Type29 barcode on the image.
''' </summary>
Class MailmarkCmdmValueItemExample   
   
    ''' <summary>
    ''' Runs the test.
    ''' </summary>
    Public Shared Sub Test()   
        ' create the Mailmark CMDM 2D barcode value
        Dim item As New MailmarkCmdmValueItem()   
        item.InformationTypeId = "0"   
        item.VersionId = "1"   
        item.[Class] = "0"   
        item.SupplyChainId = "1000009"   
        item.ItemId = "00009609"   
        item.Dps = "W1T1HQ9Z "   
        item.RtsFlag = "0"   
        item.ReturnToSenderPostCode = "SN35XX "   
        item.CustomerContent = "ABCDEFGHIJ1234567890A"   
   
        Dim infos As IBarcodeInfo()   
   
        ' create the barcode writer
        Using writer As New BarcodeWriter()   
            ' encode Mailmark CMDM Type29 barcode
            BarcodeSymbologySubsets.MailmarkCmdmType29.Encode(item, writer.Settings)   
   
            ' get image with barcode
            Using image As VintasoftBitmap = writer.GetBarcodeAsVintasoftBitmap()   
                ' create the barcode reader
                Using reader As New BarcodeReader()   
                    ' specify that reader must search for Mailmark CMDM Type29 barcodes only
                    reader.Settings.ScanBarcodeTypes = BarcodeType.None   
                    reader.Settings.ScanBarcodeSubsets.Add(BarcodeSymbologySubsets.MailmarkCmdmType29)   
   
                    ' recognize barcode
                    infos = reader.ReadBarcodes(image)   
                End Using   
            End Using   
        End Using   
   
        ' get barcode value
        Dim readItem As MailmarkCmdmValueItem = DirectCast(infos(0).ValueItems(0), MailmarkCmdmValueItem)   
   
        ' print barcode value
        Console.WriteLine("Decoded value =              '{0}'", item.ToString())   
        Console.WriteLine("Information Type ID =        '{0}'", item.InformationTypeId)   
        Console.WriteLine("Version ID =                 '{0}'", item.VersionId)   
        Console.WriteLine("Class =                      '{0}'", item.[Class])   
        Console.WriteLine("Supply Chain ID =            '{0}'", item.SupplyChainId)   
        Console.WriteLine("Item ID =                    '{0}'", item.ItemId)   
        Console.WriteLine("DPS =                        '{0}'", item.Dps)   
        Console.WriteLine("RTS Flag =                   '{0}'", item.RtsFlag)   
        Console.WriteLine("Return To Sender Post Code = '{0}'", item.ReturnToSenderPostCode)   
        Console.WriteLine("Customer Content =           '{0}'", item.CustomerContent)   
   
        ' check recognized barcode value
        If item.ToString() <> readItem.ToString() Then   
            Throw New ApplicationException()   
        End If   
    End Sub   
End Class   
   
' This code example produces the following output:
'
'   Decoded value =              'JGB 010100000900009609W1T1HQ9Z 0SN35XX       ABCDEFGHIJ1234567890A'
'   Information Type ID =        '0'
'   Version ID =                 '1'
'   Class =                      '0'
'   Supply Chain ID =            '1000009'
'   Item ID =                    '00009609'
'   DPS =                        'W1T1HQ9Z '
'   RTS Flag =                   '0'
'   Return To Sender Post Code = 'SN35XX '
'   Customer Content =           'ABCDEFGHIJ1234567890A'
'



using System;

using Vintasoft.Barcode;
using Vintasoft.Barcode.BarcodeInfo;
using Vintasoft.Barcode.SymbologySubsets;
using Vintasoft.Imaging;

/// <summary>
/// Test that demonstrates how to generate an image with Mailmark CMDM Type29 barcode and
/// how to recognize Mailmark CMDM Type29 barcode on the image.
/// </summary>
class MailmarkCmdmValueItemExample
{

    /// <summary>
    /// Runs the test.
    /// </summary>
    public static void Test()
    {
        // create the Mailmark CMDM 2D barcode value
        MailmarkCmdmValueItem item = new MailmarkCmdmValueItem();
        item.InformationTypeId = "0";
        item.VersionId = "1";
        item.Class = "0";
        item.SupplyChainId = "1000009";
        item.ItemId = "00009609";
        item.Dps = "W1T1HQ9Z ";
        item.RtsFlag = "0";
        item.ReturnToSenderPostCode = "SN35XX ";
        item.CustomerContent = "ABCDEFGHIJ1234567890A";

        IBarcodeInfo[] infos;

        // create the barcode writer
        using (BarcodeWriter writer = new BarcodeWriter())
        {
            // encode Mailmark CMDM Type29 barcode
            BarcodeSymbologySubsets.MailmarkCmdmType29.Encode(item, writer.Settings);

            // get image with barcode
            using (VintasoftBitmap image = writer.GetBarcodeAsVintasoftBitmap())
            {
                // create the barcode reader
                using (BarcodeReader reader = new BarcodeReader())
                {
                    // specify that reader must search for Mailmark CMDM Type29 barcodes only
                    reader.Settings.ScanBarcodeTypes = BarcodeType.None;
                    reader.Settings.ScanBarcodeSubsets.Add(BarcodeSymbologySubsets.MailmarkCmdmType29);

                    // recognize barcode
                    infos = reader.ReadBarcodes(image);
                }
            }
        }

        // get barcode value
        MailmarkCmdmValueItem readItem = (MailmarkCmdmValueItem)infos[0].ValueItems[0];

        // print barcode value
        Console.WriteLine("Decoded value =              '{0}'", item.ToString());
        Console.WriteLine("Information Type ID =        '{0}'", item.InformationTypeId);
        Console.WriteLine("Version ID =                 '{0}'", item.VersionId);
        Console.WriteLine("Class =                      '{0}'", item.Class);
        Console.WriteLine("Supply Chain ID =            '{0}'", item.SupplyChainId);
        Console.WriteLine("Item ID =                    '{0}'", item.ItemId);
        Console.WriteLine("DPS =                        '{0}'", item.Dps);
        Console.WriteLine("RTS Flag =                   '{0}'", item.RtsFlag);
        Console.WriteLine("Return To Sender Post Code = '{0}'", item.ReturnToSenderPostCode);
        Console.WriteLine("Customer Content =           '{0}'", item.CustomerContent);

        // check recognized barcode value
        if (item.ToString() != readItem.ToString())
            throw new ApplicationException();
    }
}

/* This code example produces the following output:

   Decoded value =              'JGB 010100000900009609W1T1HQ9Z 0SN35XX       ABCDEFGHIJ1234567890A'
   Information Type ID =        '0'
   Version ID =                 '1'
   Class =                      '0'
   Supply Chain ID =            '1000009'
   Item ID =                    '00009609'
   DPS =                        'W1T1HQ9Z '
   RTS Flag =                   '0'
   Return To Sender Post Code = 'SN35XX '
   Customer Content =           'ABCDEFGHIJ1234567890A'
*/

Inheritance Hierarchy

System.Object
   Vintasoft.Barcode.BarcodeInfo.ValueItemBase
      Vintasoft.Barcode.BarcodeInfo.MailmarkCmdmValueItem

Requirements

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

See Also