C# PDF-417 Reader Introduction
C# PDF-417 Reader SDK is a high performance C# linear and 2d barcode recognition SDK for Microsoft Visual Studio C#.NET platform.
Scan and read PDF-417 barcodes from image files is one of the barcode decoding functions in .NET Barcode Reader component. To help .net developers easiy integrate barcode reader control into your .net projects, we provide detailed online tutorial for
- Barcode Reader for C#
- Read barcode in C# ASP.NET Core web app
- Scan, read barcode in c# windows application
- Barcode Reader for .NET
- Barcode Reader for VB.NET
C#.NET Barcode Reader component supports scanning and reading 20+ linear, 2d barcodes, including
- Read QR Code in C# | Read Data Matrix in C# | Read Interleaved 2 of 5 in C# | Read EAN in C#
- Read UPC in C# | Read GS1/EAN-128 in C# | Read ISSN in C# | Read Code 39 in C#
You may also be interested in:
- Barcode Reader for Java | Java Barcode Generator for Java | Barcode Generator for .NET | Barcode Generator for C#
- Barcode Generator for ASP.NET | Barcode Generator for VB.NET
Install C#.NET Barcode Reader Control to Your C# project
- Copy OnBarcode.Barcode.BarcodeScanner.dll to your C#.NET project folder (do not copy dll file to your project bin folder).
- Add OnBarcode.BarcodeReader.dll to your C# project reference.
Reading PDF-417 in C# Class
Call BarcodeScanner.Scan() method in your C# class, and pass your barcode image file, and PDF-417 barcode type (BarcodeType.PDF-417) as method parameters.
string[] datas = BarcodeScanner.Scan("pdf-417-barcode-image.gif", BarcodeType.PDF417);
| Single PDF417 Barcode | Multiple PDF417 Barcodes from an Image File |
|
|
How to extract scanned PDF417 barcode property information in C#?
In scanned PDF417
BarcodeDetail object, call method GetBarcodeProps() to retrieve PDF417 barcode property information.
- ColumnCount. Number of data column in the PDF417 symbol (excluding start/stop pattern and left/right row indicator).
- RowCount. Number of row in the PDF417 symbol.
- DataMode. Get PDF417 data mode used in encoding. PDF417DataMode.Mix for more than 1 data modes used.
- ECL. Get PDF417 error correction level used in encoding.
- IsMacro. Indicate if it is a Macro PDF417. If it is a macro PDF417.
- MacroSegmentIndex. Get segment index. Start from 0.
- MacroFileID. Get file identification in string format. A list of codewords. Each in range 0 ~ 899.
- IsMacroLastSegment. Indicate if this symbol is the last segment.
- MacroOptFieldEnable. Indicate if it contains optional fields. If macro PDF417 contains optional fields
- MacroFileName. Get file name
- MacroSegmentCount. Get segment count
- MacroTimeStamp. Get timestamp
- MacroSender. Get Sender.
- MacroAddressee. Get Addressee.
- MacroFileSize. Get file size.
- MacroChecksum. Get checksum.
ScanOptions ops = new ScanOptions(BarcodeType.PDF417); BarcodeDetail[] result = BarcodeScanner.Scan(imgFilePath, ops); if (result != null && result.Length > 0) { foreach (BarcodeDetail b in result) { Console.WriteLine("Message: {0}", b.GetMessage()); if (b.Type == BarcodeType.PDF417) { PDF417Props props = (PDF417Props)b.GetBarcodeProps(); // Number of data column in the symbol (excluding start/stop pattern // and left/right row indicator). Console.WriteLine("Column: {0}", props.ColumnCount.ToString()); // Number of row in the symbol. Console.WriteLine("Row: {0}", props.RowCount.ToString()); // Get data mode used in encoding. // PDF417DataMode.Mix for more than 1 data modes used. Console.WriteLine("Data Mode: {0}", props.DataMode.ToString()); // Get error correction level used in encoding. Console.WriteLine("ECL: {0}", props.ECL.ToString()); // Indicate if it is a Macro PDF417. Console.WriteLine("Is Macro PDF417: {0}", props.IsMacro); if (props.IsMacro) { // Get segment index. Start from 0. Console.WriteLine("Segment Index: {0}", props.MacroSegmentIndex); // Get file identification in string format. Console.WriteLine("File ID: "); // A list of codewords. Each in range 0 ~ 899. if (props.MacroFileID != null && props.MacroFileID.Length > 0) foreach (int v in props.MacroFileID) Console.WriteLine(" " + v); // Indicate if this symbol is the last segment. Console.WriteLine("Is Last Segment: {0}", props.IsMacroLastSegment); // Indicate if it contains optional fields. Console.WriteLine("Optional Field Enable: {0}", props.MacroOptFieldEnable); if (props.MacroOptFieldEnable) { 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); } } } } }
Scan, read Macro PDF417 barcodes using C# code
Macro PDF417 provides a mechanism for the data in a file to be split into blocks and be represented in more than one PDF417 symbol. This mechanism is similar to the Structured Append feature in other symbologies, like Data Matrix, QR Code.
Each Macro PDF417 symbol shall contain additional control information to enable the original data file to be properly reconstructed, irrespective of the sequence in which the individual PDF417 symbols are scanned and decoded.
Here are list of important properties of Macro PDF-417 barcode
The steps and C# source code below show how to get the information of Macro PDF417 barcodes using C#.NET Barcode Reader library
Each Macro PDF417 symbol shall contain additional control information to enable the original data file to be properly reconstructed, irrespective of the sequence in which the individual PDF417 symbols are scanned and decoded.
Here are list of important properties of Macro PDF-417 barcode
- File id: all Macro PDF417 barcode with the same file id are the parts of the same data message
- Segment index: it is the order of the data message. The first segment index is 0
- Is the last segment: It is to know whether the current PDF417 is the last segment or not.
The steps and C# source code below show how to get the information of Macro PDF417 barcodes using C#.NET Barcode Reader library
- Utilize BarcodeScanner.ScanInDetails() to get all PDF 417 barcode information from an existing image file
- For each scanned PDF417 barcode, you will get
- Is it a Macro PDF417 barcode using BarcodeDetail.isMacroPDF417()
- Get Macro PDF417 file id using BarcodeDetail.getMacroPDF417FileID()
- Is it the last segment of Macro PDF417 using BarcodeDetail.isMacroPDF417LastSegment()
- Get Macro PDF417 segment index (the first segment index is 0) using BarcodeDetail.getMacroPDF417SegmentIndex()
- Extract Macro PDF417 data using BarcodeDetail.Data
public static void ReadMacroPDF417() { String imageFilePath = "..."; // scan all PDF417 symbols in the image file BarcodeDetail[] datas = BarcodeScanner.ScanInDetails(imageFilePath, BarcodeType.PDF417); for (int j = 0; j < datas.Length; j++) { // check if this is a Macro PDF417 Console.WriteLine(" Is Macro PDF417: " + datas[j].isMacroPDF417()); // get macro PDF 417 file id Console.WriteLine(" File id: " + datas[j].getMacroPDF417FileID()); // check if this is the last segment Console.WriteLine(" Is Last Segment: " + datas[j].isMacroPDF417LastSegment()); // get segment number (in String type) Console.WriteLine(" Segment Index: " + datas[j].getMacroPDF417SegmentIndex()); // get file ID (in String type) // Note: // All characters in this String is digital ASCII (that is 0 ~ 9) // Every 3 digits represent a number (which based on 900) Console.WriteLine(" File ID: " + datas[j].getMacroPDF417FileID()); if (datas[j].isMacroPDF417()) { // get data in the Macro PDF417 string barcodeSegmentData = datas[j].Data; // ... } } }
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 C# Barcode Reader SDK to scan and decode text from PDF417 barcode images in C# ASP.NET, Windows 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.
C# Barcode Scanner library enables you to quickly integrate PDF417 barcode reading feature in C# ASP.NET, Windows Forms, WPF web and Windows applications.
Can iPhone or Android phones scan PDF417 barcode?
With OnBarcode best-in-class C# 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.
C# Barcode Scanner library supports both PDF417 and QR Code 2d barcode reading and recognition.