简体   繁体   中英

Barcode4j UPCA scancode with leading zero

I'm trying to add a barcode to a report using Jasper Reports in UPCA format. My scancodes are strings, but Barcode4j expects a 12 digit Integer. I can convert this to an Integer, but if there is a leading zero, it is lost, and thus my scancode is now 1 digit too short.

So, how can I use the UPCA format with scancodes that have a leading 0 and keep the leading 0?

Barbecue seems to have the same issues, so I don't imagine using it as opposed to Barcode4j will solve this issue.

Well, it all came down to my test data. Using random numbers is what was causing it to fail. When I looked up UPCA examples and used those, then it worked fine. I didn't have to parse it as an Integer either.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM