Quick to scan PDF-417 in VB.NET WinForms, WPF application
Here we will demonstrate how to scan and recognize PDF-417 (2D stacked barcode symbology) using the VB.NET Barcode Reader library.
You can implement PDF-417 barcode scanning with a direct method call in VB.NET. The core scanning method accepts an image source and target barcode type as input parameters.
You can implement PDF-417 barcode scanning with a direct method call in VB.NET. The core scanning method accepts an image source and target barcode type as input parameters.
- Call the core decoding method
BarcodeScanner.Scan(). - Pass the barcode image file path as the first parameter.
- Specify the barcode type as
BarcodeType.PDF417. - The method returns a string array containing all decoded barcode data.
' Scan and decode PDF-417 barcode from image file Dim datas As String() = BarcodeScanner.Scan("pdf-417-barcode-image.gif", BarcodeType.PDF417)
How to extract scanned PDF417 barcode property information in VB.NET?
Here we will explain how to retrieve full structural and metadata properties from scanned PDF417 (2D stacked barcode symbology) using the VB.NET Barcode Reader library.
You can extract complete PDF417 barcode metadata from the scanned
Call the
This object includes structure settings, encoding modes, and Macro PDF417 extended information.
You can extract complete PDF417 barcode metadata from the scanned
BarcodeDetail object.
Call the
GetBarcodeProps() method to obtain a dedicated PDF417Props (PDF417 property entity) object.
This object includes structure settings, encoding modes, and Macro PDF417 extended information.
Supported PDF417 Core Properties
- ColumnCount: Gets the number of data columns (excludes start/stop patterns and row indicators).
- RowCount: Gets the total number of rows in the PDF417 symbol.
- DataMode: Gets the encoding data mode. Returns
PDF417DataMode.Mixif multiple modes are used. - ECL: Gets the error correction level used during encoding.
Supported Macro PDF417 Properties
- IsMacro: Indicates whether the barcode is a Macro PDF417 symbol.
- MacroSegmentIndex: Gets the segment index (starting from 0).
- MacroFileID: Gets the file ID as a list of codewords (range: 0 - 899).
- IsMacroLastSegment: Indicates whether this is the final segment in the group.
- MacroOptFieldEnable: Indicates whether optional metadata fields are included.
Optional Macro PDF417 Fields
- MacroFileName: File name
- MacroSegmentCount: Total segment count
- MacroTimeStamp: Timestamp
- MacroSender: Sender information
- MacroAddressee: Addressee information
- MacroFileSize: File size
- MacroChecksum: Checksum value
' Initialize scanning configuration for PDF417 Dim ops As New ScanOptions(BarcodeType.PDF417) ' Perform PDF417 barcode scanning Dim result As BarcodeDetail() = BarcodeScanner.Scan(imgFilePath, ops) ' Validate scanning results If result IsNot Nothing AndAlso result.Length > 0 Then ' Iterate all detected barcode records For Each b As BarcodeDetail In result Console.WriteLine("Message: {0}", b.GetMessage()) ' Check if the barcode type is PDF417 If b.Type = BarcodeType.PDF417 Then ' Convert to dedicated PDF417 property object Dim props As PDF417Props = CType(b.GetBarcodeProps(), PDF417Props) ' Output basic structure properties Console.WriteLine("Column: {0}", props.ColumnCount.ToString()) Console.WriteLine("Row: {0}", props.RowCount.ToString()) Console.WriteLine("Data Mode: {0}", props.DataMode.ToString()) Console.WriteLine("ECL: {0}", props.ECL.ToString()) ' Check and output Macro PDF417 information Console.WriteLine("Is Macro PDF417: {0}", props.IsMacro) If props.IsMacro Then Console.WriteLine("Segment Index: {0}", props.MacroSegmentIndex) Console.WriteLine("File ID: ") ' Output Macro File ID codewords If props.MacroFileID IsNot Nothing AndAlso props.MacroFileID.Length > 0 Then For Each v As Integer In props.MacroFileID Console.WriteLine(" " & v) Next End If Console.WriteLine("Is Last Segment: {0}", props.IsMacroLastSegment) Console.WriteLine("Optional Field Enable: {0}", props.MacroOptFieldEnable) ' Output optional Macro fields if enabled If props.MacroOptFieldEnable Then Console.WriteLine("File Name: {0}", props.MacroFileName) Console.WriteLine("Segment Count: {0}", props.MacroSegmentCount) Console.WriteLine("Timestamp: {0}", props.MacroTimeStamp) Console.WriteLine("Sender: {0}", props.MacroSender) Console.WriteLine("Addressee: {0}", props.MacroAddressee) Console.WriteLine("File Size: {0}", props.MacroFileSize) Console.WriteLine("Checksum: {0}", props.MacroChecksum) End If End If End If Next End If
Scan, read Macro PDF417 barcodes in Visual Basic .NET Windows application
Macro PDF417 supports splitting large file data into multiple separate PDF417 symbols.
This function is similar to the Structured Append feature used in QR Code and Data Matrix. Each symbol stores built-in control metadata.
The original complete data can be reconstructed correctly regardless of the scanning sequence.
You can retrieve full Macro PDF417 metadata using advanced scanning methods in VB.NET.
The original complete data can be reconstructed correctly regardless of the scanning sequence.
Macro PDF417 Properties
- File ID: Barcodes with the same File ID belong to the same data group.
- Segment Index: Defines the data sequence. The first segment starts at 0.
- Is Last Segment: Indicates whether the current symbol is the final data block.
You can retrieve full Macro PDF417 metadata using advanced scanning methods in VB.NET.
- Call
BarcodeScanner.ScanInDetails()to scan the image and load full barcode metadata. - Check if the barcode is a Macro PDF417.
- Read File ID, segment index, and last-segment status.
- Extract the raw segmented data for reconstruction.
Public Shared Sub ReadMacroPDF417() ' Define the path of the barcode image file Dim imageFilePath As String = "..." ' Scan all PDF417 symbols in the target image Dim datas As BarcodeDetail() = BarcodeScanner.ScanInDetails(imageFilePath, BarcodeType.PDF417) ' Iterate all scanned barcode records For j As Integer = 0 To datas.Length - 1 ' Check if current barcode is Macro PDF417 Console.WriteLine(" Is Macro PDF417: " & datas(j).isMacroPDF417()) ' Get Macro PDF417 File ID Console.WriteLine(" File id: " & datas(j).getMacroPDF417FileID()) ' Check if it is the last segment Console.WriteLine(" Is Last Segment: " & datas(j).isMacroPDF417LastSegment()) ' Get segment index (starts from 0) Console.WriteLine(" Segment Index: " & datas(j).getMacroPDF417SegmentIndex()) ' Get File ID string (3 digits = one 900-based value) Console.WriteLine(" File ID: " & datas(j).getMacroPDF417FileID()) ' Extract raw data if it is a valid Macro PDF417 If datas(j).isMacroPDF417() Then Dim barcodeSegmentData As String = datas(j).Data ' Add your data reconstruction logic here End If Next End Sub
Common Asked Questions
What is PDF417 used for?
PDF417 is a high density, two-dimensional stacked barcode format used in a variety of applications,
such as driver's license, airline boarding pass, transport, and inventory management.
You use OnBarcode VB.NET Barcode Reader SDK to scan and decode text from PDF417 barcode images in VB.NET, Windows Forms, Console, WPF application.
How to scan PDF417 barcode image?
You can use camera with app installed on smartphone, or barcode scanner device or software to scan, read PDF417 barcodes.
VB.NET Barcode Scanner library enables you to quickly integrate PDF417 barcode reading feature in Visual Basic .NET, Windows Forms, WPF console and Windows applications.
Can iPhone or Android phones scan PDF417 barcode?
With OnBarcode best-in-class VB.NET PDF417 scanner, you can scan PDF417 codes with iPhone or Android mobile devices.
What is the difference between a PDF417 and a QR Code?
Both PDF417 and QR Code are two-dimensional (2D) barcode formats. PDF417 can be scannable even if up to 50% of it is damaged. QR Code can accept up to 30% damages.
VB.NET Barcode Scanner library supports both PDF417 and QR Code 2d barcode reading and recognition in .NET class library, console, WinForms, WPF projects.