am able to generate barcode using zxing barcode library, am using …
String text = "123456789101";
int width = 300;
int height = 100;
String imgFormat = "png";
BitMatrix bitMatrix = new UPCAWriter().encode(text, BarcodeFormat.UPC_A, width, height);
MatrixToImageWriter.writeToStream(bitMatrix, imgFormat, new FileOutputStream(new File("C:\\code_.png")));
out.println("Success!");
I got my output, with plane barcode image, but i want to print ‘text(String text = “123456789101”;)’ also bottom of that image, any one know pls help me.
Thanks much.
If your library doesn’t implement such a thing, and I suppose it doesn’t as there’d be no question here otherwise, you can print your code on top of the barcode image yourself. Check this question for a brief description of how it can be done.
The other option is to output the code in plaintext under the image – not sure if it suits you.
UPD: You can also try the Barcode4j library. I think it can do such things.