简体   繁体   English

带有前导零的Barcode4j UPCA扫描代码

[英]Barcode4j UPCA scancode with leading zero

I'm trying to add a barcode to a report using Jasper Reports in UPCA format. 我正在尝试使用UPCA格式的Jasper Reports将条形码添加到报告中。 My scancodes are strings, but Barcode4j expects a 12 digit Integer. 我的扫描码是字符串,但是Barcode4j希望使用12位整数。 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. 我可以将其转换为Integer,但是如果有前导零,它将丢失,因此我的扫描码现在太短了1位。

So, how can I use the UPCA format with scancodes that have a leading 0 and keep the leading 0? 因此,如何将UPCA格式与前导0并保持前0的扫描代码一起使用?

Barbecue seems to have the same issues, so I don't imagine using it as opposed to Barcode4j will solve this issue. 烧烤似乎有相同的问题,所以我不认为使用Barcode4j可以解决此问题。

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. 当我查找并使用UPCA示例时,它工作正常。 I didn't have to parse it as an Integer either. 我也不必将其解析为Integer。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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