pqScan Java Library for Barcode Recognition is a competitive barcode scanning solution on the market. It provides high efficiency APIs to read and scan 2D bar codes, like PDF-417, Aztec Code, QR Code, and Data Matrix. On this online tutorial, we will focus on how to install Java PDF417 Scanner Library into your Java application and how to use Java APIs and demo code to quickly read and decode PDF-417 two-dimensional bar code from loaded image source.
In general, raster image file formats like Bmp, Gif, Jpeg/Jpg, Png, and Tiff/Tif are supported by our barcode reading component for Java. In addition, Java AWT image object is also allowed. By using designed APIs, Java programmers are empowered to read only PDF-417 bar code from image file or decode all detected barcode symbols on it.
In the following three sections, we will introduce how to install Java PDF417 Scanner to your Java application, how to choose suitable APIs for different requirements, and how to use free Java class programming code to scan and recognize PDF-417 barcode symbol from loaded image source.
How to Install Java Library
It's quite easy to install Java PDF417 Barcode Scanner to your Java application and two steps are involved. See as below.
- Copy pqScan.BarcodeReader.jar to your Java project library folder.
- Add pqScan.BarcodeReader.jar to your Java classpath.
How to Choose Java API
For different PDF-417 bar code symbol requirements, different Java APIs should be used. We provide specific APIs for two situations that you may take into consideration. Three APIs are available for a situation that there's only a need of reading PDF-417 2D barcode symbol from loaded image file. Of course, if there are more than one barcode types (besides PDF417 font) on your image source and you want to decode them all, another three APIs should be applied. Detailed explanations for all six APIs are demonstrated as follows.
// Read and recognize PDF417 from local image file in Java application.
public static BarcodeResult Scan(String filename);
// Recognize PDF-417 from BufferedImage object in Java application.
public static BarcodeResult Scan(BufferedImage image);
// Decode and detect PDF417 from the InputStream object in Java application.
public static BarcodeResult Scan(InputStream imageStream);
// Choose to scan and decode PDF417 only from image file at the disk in Java application.
public static BarcodeResult Scan(String filename, BarCodeType barType);
// Choose to read and recognize PDF417 only from BufferedImage object in Java application.
public static BarcodeResult Scan(BufferedImage image, BarCodeType barType);
// Choose to scan and detect PDF417 only from InputStream object in Java application.
public static BarcodeResult Scan(InputStream imageStream, BarCodeType barType);
How to Read PDF-417 in Java Class
As you see above, you can use several Java APIs to recognize PDF-417 bar code from image file. And here, we only give an example of using API "Scan(String filename, BarCodeType barType)" in Java class programming. This free Java sample code will directly to detect and decode PDF-417 on loaded Jpg image.
public class ReadPDF417Demo
public static void main(String args)
// Select PDF417 as target barcode symbol and read all from Jpeg image file.
BarcodeResult results = BarcodeScanner.Scan("C:/sample.jpg", BarCodeType.PDF417);
for(int i = 0; i < results.length; i++)
// Output all recognized bar code data information.
System.out.println(results[i].getData() + "--" + results[i].getBarType());
catch (Exception e)