我试图生成Barcode128条形码放在标签上,通常标签的宽度较小。我想知道3 digit(100)字符串条码宽度比4 digit(1001)字符串条码大。3 digit barcode应该小于4位条形码,对吗?我已经证实,在在线条形码生成中,3 digit barcode宽度小于4位条形码宽度,其中,由于iText api对3 digit字符串的宽度比4 digit string要大。
有谁能告诉我们这件事的原因以及如何制作3 digit barcode shorter than the 4 digit barcode??
在线条形码生成器URL 这里

用于生成条形码的代码示例。
Barcode128 code128 = new Barcode128();
code128.setCode(myText);
Image myBarCodeImage128 = code128.createImageWithBarcode(contentByte,
null, null);然后将图像添加到pdf文档中。
发布于 2015-12-10 14:43:32
根据保罗·苏亚雷斯的答案找到一个有用的片段。
Document document = new Document(new Rectangle(340, 842));
PdfWriter writer = PdfWriter.getInstance(document,
new FileOutputStream("barcodes.pdf"));
document.open();
PdfContentByte cb = writer.getDirectContent();
document.add(new Paragraph("Barcode 128 demo"));
Barcode128 code128 = new Barcode128();
code128.setCode("100");
code128.setCodeSet(Barcode128CodeSet.B);
document.add(code128.createImageWithBarcode(cb, null, null));
code128 = new Barcode128();
code128.setCode("1001");
code128.setCodeSet(Barcode128CodeSet.B);
document.add(code128.createImageWithBarcode(cb, null, null));
document.close();发布于 2015-12-10 09:28:50
条形码128有几种编码数字的方法。其中一种方法是在同一符号中编码2位数字。在4位大小写中,您有两个符号,每个符号有两个数字,总共有两个符号。在3位的情况下,您有两个数字的符号,一个切换到字母数字的符号,最后一个数字的符号,总共有三个符号。正如你所看到的,在这种情况下,越少越好。
https://stackoverflow.com/questions/34195452
复制相似问题