I'm trying to generate a barcode ean-128 bar code with this code I get
public class SampleBitmapBarcodeWithBean {
public static void main(String[] args) {
try {
//Create the barcode bean
EAN128Bean bean = new EAN128Bean();
final int dpi = 150;
//Configure the barcode generator
System.out.println(UnitConv.in2mm(2.0f / dpi));
bean.setModuleWidth(UnitConv.in2mm(2.0f / dpi)); //makes the narrow bar
//width exactly one pixel
bean.setTemplate("(415)n13+(8020)n18+(3900)n10+(96)n8");
bean.doQuietZone(false);
//Open output file
File outputFile = new File("out.jpg");
OutputStream out = new FileOutputStream(outputFile);
try {
//Set up the canvas provider for monochrome JPEG output
BitmapCanvasProvider canvas = new BitmapCanvasProvider(
out, "image/jpeg", dpi, BufferedImage.TYPE_BYTE_BINARY, false, 0);
//Generate the barcode
bean.generateBarcode(canvas, "41577099980004218020020062078023070873390000000055009620110812");
//Signal end of generation
canvas.finish();
} finally {
out.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
good but the problem now is that I generate the web application with this url but not generated
I wanted to know if there is any way to generate the same in my code please thank you very much in advance
This file is generated by the code
Barcode4J has some EAN-128 templates built in but your template seems not to match to any of the built-in templates. The problem: It is not currently possible to specify the EAN-128 template through the standard servlet. I recommend that you pack your Java code above into a little servlet of your own. That's probably the quickest way to solve your problem. HTH