String BarHeigh = request.getParameter("BarHeigh");
String FontSize = request.getParameter("FontSize");
Interleaved2Of5Bean bean = new Interleaved2Of5Bean();
//Configure the barcode generator
bean.setModuleWidth(UnitConv.in2mm(1.5f / Convert.toInteger(dpi)));
bean.setWideFactor(Convert.toDouble(WideFactor));
bean.doQuietZone(false);
bean.setBarHeight(Convert.toDouble(BarHeigh));
bean.setFontSize(Convert.toDouble(FontSize));
response.setContentType("image/jpeg");
response.setDateHeader("Expires", 0);
DataOutputStream out = new DataOutputStream(response.getOutputStream());
try {
//Set up the canvas provider for monochrome JPEG output
BitmapCanvasProvider canvas = new BitmapCanvasProvider(out, "image/jpeg",Convert.toInteger(dpi), BufferedImage.TYPE_BYTE_BINARY, false, Convert.toInteger(orientation));
//Generate the barcode
bean.generateBarcode(canvas, codigoBarra);
//Signal end of generation
canvas.finish();
} finally {
out.close();
}