Generate standard bar code 2 of 5 interspersed in java

Asked

Viewed 176 times

-1

Good morning, I’m trying to implement a barcode generator to generate the payment code for a billet collection type.

Researching realized needed to be in pattern 2 of 5 interspersed, the way I did this in the pattern Code128 and I don’t know and I haven’t found how to do in the pattern above.

Does anyone know how to generate in this pattern?

NOTE: The library I’m using in Java and Barcode.

This is the excerpt from the code I have:

    public static BufferedImage generateEAN13BarcodeImage(String barcodeText) {
        Code128 barcodeGenerator = new Code128();
        BitmapCanvasProvider canvas = 
          new BitmapCanvasProvider(160, BufferedImage.TYPE_BYTE_BINARY, false, 0);
     
        barcodeGenerator.generateBarcode(canvas, barcodeText);
        return canvas.getBufferedImage();
    }

from now on I thank you all!

1 answer

0

Good morning, I managed to solve. in case it was enough to instantiate an object with Interleaved2of5bean I’ll put it on the record for anyone with that doubt.

    public static BufferedImage generateBarcodeImage(String barcodeText) {
        Interleaved2Of5Bean barcodeGenerator = new Interleaved2Of5Bean();
        BitmapCanvasProvider canvas = 
          new BitmapCanvasProvider(160, BufferedImage.TYPE_BYTE_BINARY, false, 0);
     
        barcodeGenerator.generateBarcode(canvas, barcodeText);
        return canvas.getBufferedImage();
    }

Browser other questions tagged

You are not signed in. Login or sign up in order to post.