Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
169
rated 0 times [  174] [ 5]  / answers: 1 / hits: 21371  / 12 Years ago, thu, september 27, 2012, 12:00:00

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.


More From » java

 Answers
64

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.


[#82882] Wednesday, September 26, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
brianaclaras

Total Points: 23
Total Questions: 106
Total Answers: 111

Location: Japan
Member since Sat, Jun 6, 2020
4 Years ago
brianaclaras questions
Fri, Oct 15, 21, 00:00, 3 Years ago
Thu, Dec 3, 20, 00:00, 4 Years ago
Mon, May 25, 20, 00:00, 4 Years ago
Wed, Mar 4, 20, 00:00, 4 Years ago
;