VintaSoft Barcode .NET SDK 15.2: Documentation for .NET developer
Vintasoft.Barcode.SymbologySubsets Namespace / Sscc18BarcodeSymbology Class
Members Object Syntax Example Hierarchy Requirements SeeAlso
In This Topic
    Sscc18BarcodeSymbology Class
    In This Topic
    Defines the SSCC-18 barcode symbology - subset of GS1-128 (UCC/EAN-128) barcode symbology with SSCC (Serial Shipping Container Code) value.
    Object Model
    BarcodeSymbologySubset GS1Codec Sscc18BarcodeSymbology
    Syntax
    'Declaration
    
    Public Class Sscc18BarcodeSymbology
       Inherits GS1BarcodeSymbologySubset
    
    
    public class Sscc18BarcodeSymbology : GS1BarcodeSymbologySubset
    
    
    public __gc class Sscc18BarcodeSymbology : public GS1BarcodeSymbologySubset*
    
    
    public ref class Sscc18BarcodeSymbology : public GS1BarcodeSymbologySubset^
    
    
    Example

    This C#/VB.NET code shows how to generate and recognize SSCC18 barcode.

       
    Imports Vintasoft.Barcode   
    Imports Vintasoft.Barcode.BarcodeInfo   
    Imports Vintasoft.Barcode.GS1   
    Imports Vintasoft.Barcode.SymbologySubsets   
    Imports Vintasoft.Barcode.TextRendering   
    Imports Vintasoft.Imaging   
       
    Class SSCC18Example   
        ''' <summary>
        ''' Generates and recognizes SSCC18 barcode.
        ''' </summary>
        Public Shared Sub Test()   
            ' create SSCC18 value
            Dim sscc18Value As GS1ApplicationIdentifierValue = CreateSSCC18Value("0", "460123456", "0000001")   
       
            ' generate barcode image
            Using barcodeImage As VintasoftBitmap = GenerateRasterBitmap(sscc18Value)   
                ' save image to file
                ImageCodecs.[Default].Encode(barcodeImage, "sscc18.png")   
       
                ' recognize barcode value
                Dim recognizedValue As GS1ApplicationIdentifierValue = Recognize(barcodeImage)   
       
                ' check value
                If sscc18Value.ToString() <> recognizedValue.ToString() Then   
                    Throw New ApplicationException()   
                End If   
       
                Console.WriteLine("SSCC18 Value:")   
                Console.WriteLine("Extension digit         : " & recognizedValue.Value.Substring(0, 1))   
                Console.WriteLine("GS1 Company Prefix      : " & recognizedValue.Value.Substring(1, 9))   
                Console.WriteLine("Serial reference number : " & recognizedValue.Value.Substring(1 + 9, 7))   
                Console.WriteLine("Check digit             : " & recognizedValue.Value.Substring(1 + 9 + 7, 1))   
                Console.WriteLine("SSCC18 Printable value  : " & GS1Codec.GetPrintableValue(New GS1ApplicationIdentifierValue() {recognizedValue}))   
            End Using   
        End Sub   
       
        ''' <summary>
        ''' Creates the value of SSCC18 barcode.
        ''' </summary>
        ''' <param name="extensionDigit">The extension digit.</param>
        ''' <param name="gs1CompanyPrefix">The GS1 Company Prefix number.</param>
        ''' <param name="serialReference">The serial reference number.</param>
        ''' <returns>The SSCC18 barcode value.</returns>
        ''' <remarks>
        ''' The check digit calculates automatically.
        ''' </remarks>
        Public Shared Function CreateSSCC18Value(extensionDigit As String, gs1CompanyPrefix As String, serialReference As String) As GS1ApplicationIdentifierValue   
            ' gets SSCC18 Application Identifier
            Dim sscc18Identifier As GS1ApplicationIdentifier = GS1ApplicationIdentifiers.FindApplicationIdentifier("00")   
       
            ' create SSCC18 value (format: N17C)
            Return New GS1ApplicationIdentifierValue(sscc18Identifier, extensionDigit & gs1CompanyPrefix & serialReference & "C")   
        End Function   
       
        ''' <summary>
        ''' Generates the SSCC18 barcode image.
        ''' </summary>
        ''' <param name="sscc18Value">The barcode value.</param>
        ''' <returns>The SSCC18 barcode image.</returns>
        Private Shared Function GenerateRasterBitmap(sscc18Value As GS1ApplicationIdentifierValue) As VintasoftBitmap   
            ' for Windows
            Vintasoft.Barcode.GdiAssembly.Init()   
       
            ' create barcode writer
            Using writer As New BarcodeWriter()   
                ' disable printable value auto letter spacing
                writer.Settings.ValueAutoLetterSpacing = False   
                ' set font to default font, 16 pt
                writer.Settings.ValueFont = TextRenderingFactory.[Default].CreateDefaultFont(16)   
       
                ' encode SSCC18 barcode to writer settings
                Dim valueItem As New GS1ValueItem(New GS1ApplicationIdentifierValue() {sscc18Value})   
                BarcodeSymbologySubsets.SSCC18.Encode(valueItem, writer.Settings)   
       
                ' generate barcode image
                Return writer.GetBarcodeAsVintasoftBitmap()   
            End Using   
        End Function   
       
        ''' <summary>
        ''' Recognizes the SSCC18 barcode from image.
        ''' </summary>
        ''' <param name="barcodeImage">The barcode image.</param>
        Private Shared Function Recognize(barcodeImage As VintasoftBitmap) As GS1ApplicationIdentifierValue   
            ' create barcode reader
            Using reader As New BarcodeReader()   
                ' specify that SSCC18 barcode must be recognizeds
                reader.Settings.ScanBarcodeSubsets.Add(BarcodeSymbologySubsets.SSCC18)   
       
                ' recognize barcode
                Dim info As IBarcodeInfo = reader.ReadBarcodes(barcodeImage)(0)   
       
                ' return SSCC18 value
                Return DirectCast(info.ValueItems(0), GS1ValueItem).ApplicationIdentifierValues(0)   
            End Using   
        End Function   
    End Class
    
    
    
    using System;
    using Vintasoft.Barcode;
    using Vintasoft.Barcode.BarcodeInfo;
    using Vintasoft.Barcode.GS1;
    using Vintasoft.Barcode.SymbologySubsets;
    using Vintasoft.Barcode.TextRendering;
    using Vintasoft.Imaging;
    
    class SSCC18Example
    {
        /// <summary>
        /// Generates and recognizes SSCC18 barcode.
        /// </summary>
        public static void Test()
        {
            // create SSCC18 value
            GS1ApplicationIdentifierValue sscc18Value = CreateSSCC18Value("0", "460123456", "0000001");
    
            // generate barcode image
            using (VintasoftBitmap barcodeImage = GenerateRasterBitmap(sscc18Value))
            {
                // save image to file
                ImageCodecs.Default.Encode(barcodeImage, "sscc18.png");
    
                // recognize barcode value
                GS1ApplicationIdentifierValue recognizedValue = Recognize(barcodeImage);
    
                // check value
                if (sscc18Value.ToString() != recognizedValue.ToString())
                    throw new ApplicationException();
    
                Console.WriteLine("SSCC18 Value:");
                Console.WriteLine("Extension digit         : " + recognizedValue.Value.Substring(0, 1));
                Console.WriteLine("GS1 Company Prefix      : " + recognizedValue.Value.Substring(1, 9));
                Console.WriteLine("Serial reference number : " + recognizedValue.Value.Substring(1 + 9, 7));
                Console.WriteLine("Check digit             : " + recognizedValue.Value.Substring(1 + 9 + 7, 1));
                Console.WriteLine("SSCC18 Printable value  : " + GS1Codec.GetPrintableValue(new GS1ApplicationIdentifierValue[] { recognizedValue }));
            }
        }
    
        /// <summary>
        /// Creates the value of SSCC18 barcode.
        /// </summary>
        /// <param name="extensionDigit">The extension digit.</param>
        /// <param name="gs1CompanyPrefix">The GS1 Company Prefix number.</param>
        /// <param name="serialReference">The serial reference number.</param>
        /// <returns>The SSCC18 barcode value.</returns>
        /// <remarks>
        /// The check digit calculates automatically.
        /// </remarks>
        public static GS1ApplicationIdentifierValue CreateSSCC18Value(string extensionDigit, string gs1CompanyPrefix, string serialReference)
        {
            // gets SSCC18 Application Identifier
            GS1ApplicationIdentifier sscc18Identifier = GS1ApplicationIdentifiers.FindApplicationIdentifier("00");
    
            // create SSCC18 value (format: N17C)
            return new GS1ApplicationIdentifierValue(sscc18Identifier, extensionDigit + gs1CompanyPrefix + serialReference + "C");
        }
    
        /// <summary>
        /// Generates the SSCC18 barcode image.
        /// </summary>
        /// <param name="sscc18Value">The barcode value.</param>
        /// <returns>The SSCC18 barcode image.</returns>
        private static VintasoftBitmap GenerateRasterBitmap(GS1ApplicationIdentifierValue sscc18Value)
        {
            // for Windows
            Vintasoft.Barcode.GdiAssembly.Init();
    
            // create barcode writer
            using (BarcodeWriter writer = new BarcodeWriter())
            {
                // disable printable value auto letter spacing
                writer.Settings.ValueAutoLetterSpacing = false;
                // set font to default font, 16 pt
                writer.Settings.ValueFont = TextRenderingFactory.Default.CreateDefaultFont(16);
    
                // encode SSCC18 barcode to writer settings
                GS1ValueItem valueItem = new GS1ValueItem(new GS1ApplicationIdentifierValue[] { sscc18Value });
                BarcodeSymbologySubsets.SSCC18.Encode(valueItem, writer.Settings);
    
                // generate barcode image
                return writer.GetBarcodeAsVintasoftBitmap();
            }
        }
    
        /// <summary>
        /// Recognizes the SSCC18 barcode from image.
        /// </summary>
        /// <param name="barcodeImage">The barcode image.</param>
        private static GS1ApplicationIdentifierValue Recognize(VintasoftBitmap barcodeImage)
        {
            // create barcode reader
            using (BarcodeReader reader = new BarcodeReader())
            {
                // specify that SSCC18 barcode must be recognizeds
                reader.Settings.ScanBarcodeSubsets.Add(BarcodeSymbologySubsets.SSCC18);
    
                // recognize barcode
                IBarcodeInfo info = reader.ReadBarcodes(barcodeImage)[0];
    
                // return SSCC18 value
                return ((GS1ValueItem)info.ValueItems[0]).ApplicationIdentifierValues[0];
            }
        }    
    }
    
    

    Inheritance Hierarchy

    System.Object
       Vintasoft.Barcode.BarcodeSymbology
          Vintasoft.Barcode.SymbologySubsets.BarcodeSymbologySubset
             Vintasoft.Barcode.SymbologySubsets.GS1BarcodeSymbologySubset
                Vintasoft.Barcode.SymbologySubsets.Sscc18BarcodeSymbology

    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