Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Barcode generation for Vaadin
We're implementing barcode generation for one of our apps, so my question is - is this feature can be useful for anyone else ? I can then migrate the component to TPT project then, to the next version.
P.S. we're mainly generating QR-code, for on-screen recognition, but it would be easy to support other symbiologes as low-level library anyway supports them. Just not sure if this could be widely used or not.
Our requirement is a bit rare - the barcode will be recognized by the Android / iPhone device to scan transaction information and compute the authorization code.
Will it support this usecase? ;)
Jokes aside, I believe that barcode functionality would be useful for many applications, eg. tracking codes, ticketing solutions (both mobile and print-at-home) etc.
I have a working example of barcode generation creating on screen bar code, fairly trivial to set up by using Barcode4j and ImageFilter might be able to use embedded but anyway.
Code basically ended up like this, no special widgets required. Lots of barcode types you can create
BitmapCanvasProvider canvas = new BitmapCanvasProvider(dpi, 1,false, 0)
//Generate the barcode
bean.generateBarcode(canvas, "PhilB");
//Signal end of generation
canvas.finish();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(canvas.getBufferedImage(), "png", baos);
byte[] bytesOut = baos.toByteArray();
Image image = new Image(bytesOut,false);
mainWindow.addComponent(image);
Yes, we also tried barcode4j for that, but it much simplier to reduce all the code above to just a single line
addComponent ( new TPTBarcode ( "VAADIN", TPTBarcode.TYPE_CODE39 ));
So server-side widget is still actual :)
Ok, I think it worth to move this to tpt trunk :)
OK I could have reduced my code to a single liner too :*) and I'm not saying it's not useful to have this contained in some lib. My main point really is that it's quite refreshing to find that its easy and fairly trivial first to find some java functionality and secondly to integrate it into Vaadin and really you dont need in some cases to do anything particularly special in your code.
Keep up the good work wih TPT.
This is actually how the TPT born - we finally end up copy-pasting a large number of small and trivial pieces of code between all our Vaadin-powered projects, then updading or enchancing all of them, so I moved all this stuff into an external library :)
Did barcode generation ever get into TPT? I can see many applications for it, and actually am in need of it now.
Hi Benicio,
yep, it is planned to upcoming 2.0 TPT release. Unfortunately, we were (and still) busy internally with our huge project this summer/autumn, so were focused on adding mostly project specific things to TPT.
I think 2.0 will be released in the mid of September, as soon as we finish our high-load activities.
Identify all your raw materials, work-in-process inventory, finished goods, supplies, tools and more with barcoded labels and scanning. Select from a library of thousands of barcode labels designed for specific destinations, or create your own templates using the label designer application.
How we can implement this ant addon pls..?
Seshu .: Identify all your raw materials, work-in-process inventory, finished goods, supplies, tools and more with barcoded labels and scanning. Select from a library of thousands of barcode labels designed for specific destinations, or create your own templates using the label designer application.
How we can implement this ant addon pls..?
Which barcode control did you mention that can create bar code label?