barcode.setModuleWidth(1.0);
barcode.setBarHeight(40.0);
barcode.setFontSize(10.0);
barcode.setQuietZone(10.0);
barcode.doQuietZone(true);
BarcodeDimension dim = barcode.calcDimensions(value);
int width = (int) dim.getWidth(0) + 20;
int height = (int) dim.getHeight(0);
BufferedImage imgtext = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Graphics2D g2d = imgtext.createGraphics();
g2d.setColor(Color.WHITE);