Java Barcode PDF 417 Scanner Introduction
Scanning and reading barcode PDF 417 from image file is a key feature in OnBarcode
Java Barcode Reader library SDK.
Java Barcode Reader is completely developed in Java SDK 1.4.2, and you can easy integrate the barcode reading feature in your Java project without any registration key, activation code.
Install Java Barcode Reader library
- Add downloaded OnBarcode.BarcodeReader.jar to the Java project reference.
Reading & Scanning PDF 417 Barcodes in Java class
Use method
Besides image file, you can also pass java.awt.image.RenderedImage object to the
BarcodeScanner.Scan() to quickly extract all PDF417 barcodes from a specified image file path in Java application.
String[] datas = BarcodeScanner.Scan( "PDF417-sample-image.png", BarcodeType.PDF417);
Besides image file, you can also pass java.awt.image.RenderedImage object to the
Scan method.
How to read scanned PDF417 properties in Java class
In returned PDF417
BarcodeDetail object, call method GetBarcodeProps() to retrieve QR Code 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.
BarcodeDetail[] result = BarcodeScanner.ScanInDetails( "pdf417-sample-image.png", BarcodeType.PDF417); if (result != null && result.length > 0) { for (BarcodeDetail b : result) { System.out.println("Message: " + b.getMessage()); if (b.getType() == BarcodeType.PDF417) { PDF417Props props = (PDF417Props)b.getBarcodeProps(); // Number of data column in the symbol (excluding start/stop pattern // and left/right row indicator). System.out.println("Column: " + props.getColumnCount()); // Number of row in the symbol. System.out.println("Row: " + props.getRowCount()); // Get data mode used in encoding. // PDF417DataMode.Mix for more than 1 data modes used. System.out.println("Data Mode: " + props.getDataMode().toString()); // Get error correction level used in encoding. System.out.println("ECL: " + props.getECL().toString()); // Indicate if it is a Macro PDF417. System.err.println("Is Macro PDF417: " + props.isMacro()); if (props.isMacro()) { // Get segment index. Start from 0. System.out.println("Segment Index: " + props.getMacroSegmentIndex()); // Get file identification in string format. System.out.println("File ID: "); // A list of codewords. Each in range 0 ~ 899. int[] macroFileIDs = props.getMacroFileID(); if (macroFileIDs != null && macroFileIDs.length > 0) for (int v : macroFileIDs) System.out.println(" " + v); // Indicate if this symbol is the last segment. System.out.println("Is Last Segment: " + props.isMacroLastSegment()); // Indicate if it contains optional fields. System.out.println("Optional Field Enable: " + props.getMacroOptFieldEnable()); if (props.getMacroOptFieldEnable()) { System.out.println("File Name: " + props.getMacroFileName()); System.out.println("Segment Count: " + props.getMacroSegmentCount()); System.out.println("Timestamp: " + props.getMacroTimeStamp()); System.out.println("Sender: " + props.getMacroSender()); System.out.println("Addressee: " + props.getMacroAddressee()); System.out.println("File Size: " + props.getMacroFileSize()); System.out.println("Checksum: " + props.getMacroChecksum()); } } } } }
Reading & Scanning PDF 417 Barcodes in Java class
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.
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.
OnBarcode Java PDF417 Barcode Scanner supports reading Macro PDF417 barcodes in Java application. The demo Java source code below explains how to read and view the Macro PDF 417 data in Java web and desktop applications.
OnBarcode Java PDF417 Barcode Scanner supports reading Macro PDF417 barcodes in Java application. The demo Java source code below explains how to read and view the Macro PDF 417 data in Java web and desktop applications.
- Use method
isMacro()to check whether the scanned PDF417 is a Mcro PDF417 barcode. - Use method
getMacroFileID()to get file ID. All Macro PDF417 barcode with the same file id are the parts of the same data message - Use method
getMacroSegmentIndex()to get the order of the data message. The first segment index is 0.
BarcodeDetail[] result = BarcodeScanner.ScanInDetails( "macro-pdf417-image.png", BarcodeType.PDF417); if (result != null && result.length > 0) { for (BarcodeDetail b : result) { System.out.println("Message: " + b.getMessage()); if (b.getType() == BarcodeType.PDF417) { PDF417Props props = (PDF417Props)b.getBarcodeProps(); // Indicate if it is a Macro PDF417. System.err.println("Is Macro PDF417: " + props.isMacro()); if (props.isMacro()) { // Get segment index. Start from 0. System.out.println("Segment Index: " + props.getMacroSegmentIndex()); // Get file identification in string format. System.out.println("File ID: "); // A list of codewords. Each in range 0 ~ 899. int[] macroFileIDs = props.getMacroFileID(); if (macroFileIDs != null && macroFileIDs.length > 0) for (int v : macroFileIDs) System.out.println(" " + v); // Indicate if this symbol is the last segment. System.out.println("Is Last Segment: " + props.isMacroLastSegment()); // Indicate if it contains optional fields. System.out.println("Optional Field Enable: " + props.getMacroOptFieldEnable()); if (props.getMacroOptFieldEnable()) { System.out.println("File Name: " + props.getMacroFileName()); System.out.println("Segment Count: " + props.getMacroSegmentCount()); System.out.println("Timestamp: " + props.getMacroTimeStamp()); System.out.println("Sender: " + props.getMacroSender()); System.out.println("Addressee: " + props.getMacroAddressee()); System.out.println("File Size: " + props.getMacroFileSize()); System.out.println("Checksum: " + props.getMacroChecksum()); } } } } }
Common Asked Questions
What is PDF417 used for?
PDF417 is a high density, 2d stacked barcode format used in a variety of applications,
such as driver's license, airline boarding pass ticket, transport, and inventory management.
You could use OnBarcode Java Barcode Reader SDK to scan and decode text from PDF417 barcode images in Java desktop and web applications.
How to scan PDF417 barcode image?
You can use camera with barcode app installed on smartphone (iOS or Android), or barcode scanner device or software to scan, read PDF417 barcodes.
Java Barcode Scanner library enables you to quickly integrate PDF417 barcode reading and decoding feature in Java class.
Can iPhone or Android phones scan PDF417 barcode?
With OnBarcode best-in-class Java PDF417 reader and scanner, you can scan, recognize and decode PDF417 codes using 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.
Java Barcode Reader library supports both PDF417 and QR Code 2d barcode reading and recognition.