Reputation: 31
im using itext 5.4 to generate some 128 type barcode, but i am strugling to find any way to generate the barcode bar with more space between them. could anyone help? I tried lots of itext options, but none of them worked.
Here is a snippet of the code:
Barcode barcode = new Barcode128();
barcode.setBarHeight(50);
barcode.setCode(text);
Image img = barcode.createAwtImage(Color.BLACK, Color.WHITE);
BufferedImage bi = new BufferedImage(img.getWidth(null),
img.getHeight(null), BufferedImage.TYPE_INT_RGB);
Graphics2D g2d = bi.createGraphics();
g2d.drawImage(img, 0, 0, null);
Upvotes: 0
Views: 229
Reputation: 31
I tried that, but it didn't work, what I had to do was call the method img.getScaledDefinition, or somethind like that, passing in the new width of the image.
Upvotes: 0