[英]How to create fixed size(height and width) 2d barcode using itext API in JAVA?
I am trying to create a fixed size(height and width) 2d barcode in java using itext api, but barcode size is changing based on length of code we set to barcode object.我正在尝试使用 itext api 在 java 中创建一个固定大小(高度和宽度)的二维条码,但条码大小正在根据我们设置为条码对象的代码长度而变化。 More the length of code we set, longer the barcode is generated.
我们设置的代码长度越长,生成的条形码就越长。 please help.
请帮忙。
BarcodePDF417 barcode = new BarcodePDF417();
barcode.setCode("BarcodePDF417 barcode");
Here is A Blank PDF417 BarCode with NO Data这是一个没有数据的空白 PDF417 条码
Here is the minimal test data just a small one line phrase这是最小的测试数据只是一个小的单行短语
Here is a longer single line of text "The quick brown fox jumps over the lazy dog"这是一行较长的文本“快速的棕色狐狸跳过懒惰的狗”
And "PDF417 is a stacked linear barcode symbol format used in a variety of applications, primarily transport, identification cards, and inventory management." “PDF417 是一种堆叠式线性条码符号格式,用于各种应用,主要是运输、身份证和库存管理。” produces
产生
Clearly as you add more content the size needs to increase in steps.显然,随着您添加更多内容,大小需要逐步增加。
See https://en.wikipedia.org/wiki/PDF417 where it explains how the barcode needs to be much longer for PDF417 characters than say a QR type barcode and can thus never be "fixed" height for a fixed width unless code length is always the same.请参阅https://en.wikipedia.org/wiki/PDF417 ,其中解释了 PDF417 字符的条码如何比 QR 类型条码长得多,因此除非代码长度,否则永远不能为固定宽度“固定”高度总是一样的。 Also consider distance to scanner also dictates the minimum working area where for a QR code the size ratio is recommended as 1/10 scanner distance but I dont know how that is guaged for PDF417 as it is usually scanned in contact thus the key is the minimum size of x (1) and y (usually 3) needed to achieve a reliable result.
还要考虑到扫描仪的距离也决定了最小工作区域,对于 QR 码,建议尺寸比为 1/10 扫描仪距离,但我不知道 PDF417 是如何测量的,因为它通常是接触式扫描的,因此关键是最小的获得可靠结果所需的 x (1) 和 y (通常为 3) 的大小。
For comparisons against your own output you can use an online creator such as https://bcgen.com/pdf417-barcode-creator.html为了与您自己的输出进行比较,您可以使用在线创建器,例如https://bcgen.com/pdf417-barcode-creator.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.