VintaSoft Barcode .NET SDK 12.5
Vintasoft.Barcode.SymbologySubsets.XFACompressed Namespace / XFACompressedPDF417BarcodeSymbology Class
Members Example




In This Topic
    XFACompressedPDF417BarcodeSymbology Class
    In This Topic
    Defines the PDF417 barcode symbology subset with barcode values, which are compressed as defined in Adobe XFA Specification.
    Object Model
    XFACompressedPDF417BarcodeSymbology ClassBarcodeSymbologySubset Class
    Syntax
    'Declaration
     
    Public Class XFACompressedPDF417BarcodeSymbology 
       Inherits XFACompressedBarcodeSymbologySubset
    'Usage
     
    Dim instance As XFACompressedPDF417BarcodeSymbology
    public class XFACompressedPDF417BarcodeSymbology : XFACompressedBarcodeSymbologySubset 
    public __gc class XFACompressedPDF417BarcodeSymbology : public XFACompressedBarcodeSymbologySubset 
    public ref class XFACompressedPDF417BarcodeSymbology : public XFACompressedBarcodeSymbologySubset 
    Example
    Here is an example that demonstrates how to generate PDF417 barcode with XFA compressed data.
    ''' <summary>
    ''' Generates PDF417 barcode with XFA compression.
    ''' </summary>
    Public Sub GeneratePdf417BarcodeWithXfaCompression()
        Dim barcodeText As String =
            "https://www.vintasoft.com/vsbarcode-dotnet-index.html" & System.Environment.NewLine &
            "https://www.vintasoft.com/vstwain-dotnet-index.html" & System.Environment.NewLine &
            "https://www.vintasoft.com/vstwain-index.html" & System.Environment.NewLine &
            "https://www.vintasoft.com/vsimaging-dotnet-index.html" & System.Environment.NewLine &
            "https://www.vintasoft.com/vsannotation-dotnet-index.html" & System.Environment.NewLine &
            "https://www.vintasoft.com/vspdf-dotnet-index.html" & System.Environment.NewLine &
            "https://www.vintasoft.com/vsjbig2-dotnet-index.html" & System.Environment.NewLine &
            "https://www.vintasoft.com/vsjpeg2000-dotnet-index.html" & System.Environment.NewLine &
            "https://www.vintasoft.com/vsdoccleanup-dotnet-index.html" & System.Environment.NewLine &
            "https://www.vintasoft.com/vsocr-dotnet-index.html" & System.Environment.NewLine &
            "https://www.vintasoft.com/vsdicom-dotnet-index.html" & System.Environment.NewLine &
            "https://www.vintasoft.com/vsformsprocessing-dotnet-index.html" & System.Environment.NewLine &
            "https://www.vintasoft.com/vsoffice-dotnet-index.html"
                
        ' create the barcode writer
        Dim barcodeWriter As New Vintasoft.Barcode.BarcodeWriter()
                
        ' create the XFA compressed PDF417 barcode symbology
        Dim xfaCompressedPdf417BarcodeSymbology As New Vintasoft.Barcode.SymbologySubsets.XFACompressed.XFACompressedPDF417BarcodeSymbology()
        ' encode barcode text using XFA compressed PDF417 barcode symbology
        xfaCompressedPdf417BarcodeSymbology.Encode(barcodeText, barcodeWriter.Settings)
                
        ' get barcode as image
        Using barcodeImage As System.Drawing.Image = barcodeWriter.GetBarcodeAsBitmap()
            ' save the barcode image to a file
            barcodeImage.Save("pdf417-barcode-with-xfa-compression.png")
        End Using
    End Sub
                
    ''' <summary>
    ''' Recognizes PDF417 barcode with XFA compression.
    ''' </summary>
    Public Sub RecognizePdf417BarcodeWithXfaCompression()
        ' create barcode reader
        Using reader As New Vintasoft.Barcode.BarcodeReader()
            ' specify that reader must search for XFA compressed PDF417 barcodes
            reader.Settings.ScanBarcodeSubsets.Add(Vintasoft.Barcode.SymbologySubsets.BarcodeSymbologySubsets.XFACompressedPDF417)
                
            ' specify that reader must search for horizontal barcodes only
            reader.Settings.ScanDirection = Vintasoft.Barcode.ScanDirection.Horizontal
                
            ' read barcodes from image file
            Dim barcodeInfos As Vintasoft.Barcode.IBarcodeInfo() = reader.ReadBarcodes("pdf417-barcode-with-xfa-compression.png")
                
            ' if barcodes are not detected
            If barcodeInfos.Length = 0 Then
                System.Console.WriteLine("Barcodes are not found.")
            Else
                ' if barcodes are detected
                ' get information about recognized barcodes
                
                System.Console.WriteLine(String.Format("{0} barcode(s) found:", barcodeInfos.Length))
                System.Console.WriteLine()
                For i As Integer = 0 To barcodeInfos.Length - 1
                    Dim barcodeInfo As Vintasoft.Barcode.IBarcodeInfo = barcodeInfos(i)
                    System.Console.WriteLine(String.Format("[{0}:{1}]", i + 1, barcodeInfo.BarcodeType))
                    System.Console.WriteLine(String.Format("Value:      {0}", barcodeInfo.Value))
                    System.Console.WriteLine(String.Format("Region:     {0}", barcodeInfo.Region))
                    System.Console.WriteLine()
                Next
            End If
        End Using
    End Sub
    /// <summary>
    /// Generates PDF417 barcode with XFA compression.
    /// </summary>
    public void GeneratePdf417BarcodeWithXfaCompression()
    {
        string barcodeText =
            "https://www.vintasoft.com/vsbarcode-dotnet-index.html" + System.Environment.NewLine +
            "https://www.vintasoft.com/vstwain-dotnet-index.html" + System.Environment.NewLine +
            "https://www.vintasoft.com/vstwain-index.html" + System.Environment.NewLine +
            "https://www.vintasoft.com/vsimaging-dotnet-index.html" + System.Environment.NewLine +
            "https://www.vintasoft.com/vsannotation-dotnet-index.html" + System.Environment.NewLine +
            "https://www.vintasoft.com/vspdf-dotnet-index.html" + System.Environment.NewLine +
            "https://www.vintasoft.com/vsjbig2-dotnet-index.html" + System.Environment.NewLine +
            "https://www.vintasoft.com/vsjpeg2000-dotnet-index.html" + System.Environment.NewLine +
            "https://www.vintasoft.com/vsdoccleanup-dotnet-index.html" + System.Environment.NewLine +
            "https://www.vintasoft.com/vsocr-dotnet-index.html" + System.Environment.NewLine +
            "https://www.vintasoft.com/vsdicom-dotnet-index.html" + System.Environment.NewLine +
            "https://www.vintasoft.com/vsformsprocessing-dotnet-index.html" + System.Environment.NewLine +
            "https://www.vintasoft.com/vsoffice-dotnet-index.html";
                
        // create the barcode writer
        Vintasoft.Barcode.BarcodeWriter barcodeWriter = new Vintasoft.Barcode.BarcodeWriter();
                
        // create the XFA compressed PDF417 barcode symbology
        Vintasoft.Barcode.SymbologySubsets.XFACompressed.XFACompressedPDF417BarcodeSymbology xfaCompressedPdf417BarcodeSymbology =
            new Vintasoft.Barcode.SymbologySubsets.XFACompressed.XFACompressedPDF417BarcodeSymbology();
        // encode barcode text using XFA compressed PDF417 barcode symbology
        xfaCompressedPdf417BarcodeSymbology.Encode(barcodeText, barcodeWriter.Settings);
                
        // get barcode as image
        using (System.Drawing.Image barcodeImage = barcodeWriter.GetBarcodeAsBitmap())
        {
            // save the barcode image to a file
            barcodeImage.Save("pdf417-barcode-with-xfa-compression.png");
        }
    }
                
    /// <summary>
    /// Recognizes PDF417 barcode with XFA compression.
    /// </summary>
    public void RecognizePdf417BarcodeWithXfaCompression()
    {
        // create barcode reader
        using (Vintasoft.Barcode.BarcodeReader reader = new Vintasoft.Barcode.BarcodeReader())
        {
            // specify that reader must search for XFA compressed PDF417 barcodes
            reader.Settings.ScanBarcodeSubsets.Add(Vintasoft.Barcode.SymbologySubsets.BarcodeSymbologySubsets.XFACompressedPDF417);
                
            // specify that reader must search for horizontal barcodes only
            reader.Settings.ScanDirection = Vintasoft.Barcode.ScanDirection.Horizontal;
                
            // read barcodes from image file
            Vintasoft.Barcode.IBarcodeInfo[] barcodeInfos = reader.ReadBarcodes("pdf417-barcode-with-xfa-compression.png");
                
            // if barcodes are not detected
            if (barcodeInfos.Length == 0)
            {
                System.Console.WriteLine("Barcodes are not found.");
            }
            // if barcodes are detected
            else
            {
                // get information about recognized barcodes
                
                System.Console.WriteLine(string.Format("{0} barcode(s) found:", barcodeInfos.Length));
                System.Console.WriteLine();
                for (int i = 0; i < barcodeInfos.Length; i++)
                {
                    Vintasoft.Barcode.IBarcodeInfo barcodeInfo = barcodeInfos[i];
                    System.Console.WriteLine(string.Format("[{0}:{1}]", i + 1, barcodeInfo.BarcodeType));
                    System.Console.WriteLine(string.Format("Value:      {0}", barcodeInfo.Value));
                    System.Console.WriteLine(string.Format("Region:     {0}", barcodeInfo.Region));
                    System.Console.WriteLine();
                }
            }
        }
    }
    Inheritance Hierarchy

    System.Object
       Vintasoft.Barcode.BarcodeSymbology
          Vintasoft.Barcode.SymbologySubsets.BarcodeSymbologySubset
             Vintasoft.Barcode.SymbologySubsets.XFACompressed.XFACompressedBarcodeSymbologySubset
                Vintasoft.Barcode.SymbologySubsets.XFACompressed.XFACompressedPDF417BarcodeSymbology

    Requirements

    Target Platforms: .NET 6; .NET 5; .NET Core 3.1; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    See Also