Scanning Multiple 1D Barcodes (CODE -128) with ZXING

319 views Asked by At

I have managed to scan a TIFF file with ZXING. this file has 4 1D barcodes inside but ZXING brings out 2 horizontal barcodes. How can it be possible to scan the Verticals barcodes? The current code scans successfully ONLY horizontal barcodes, but failed to discover the vertical barcodes?

Here is my code:

public static void main(String[] args) throws IOException, NotFoundException {
    InputStream barCodeInputStream = new FileInputStream("C:/Temp/test.tif");
    BufferedImage barCodeBufferedImage = ImageIO.read(barCodeInputStream);
    LuminanceSource source = new BufferedImageLuminanceSource(barCodeBufferedImage);
    BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
    com.google.zxing.Reader reader = new MultiFormatReader();
    MultipleBarcodeReader bcReader = new GenericMultipleBarcodeReader(reader);

    Hashtable<DecodeHintType, Object> hints = new Hashtable<DecodeHintType, Object>();
    hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);

    StringBuilder sb = new StringBuilder();
    for (Result result : bcReader.decodeMultiple(bitmap, hints)) {
        sb.append(result.getText()).append(" \n");
    }
    System.out.println(sb.toString());
}
0

There are 0 answers