扫描仪无法识别iText 2D条形码

时间:2019-06-20 18:04:16

标签: java itext barcode

我有一个Java Swing应用程序,该应用程序生成要在Soho贴纸上打印的条形码标签。然后将贴纸放在实际物品上,在我的情况下是书籍。

我已按照“ iText in Action,第二版”第334页中的说明执行了生成2D条码的步骤。我在PDF文档中生成了条码并进行打印,但这是无法进行的扫描。我的扫描仪是E-POS,型号EC301,可以非常快速地扫描其他条形码标签。我的代码如下所示:

private PdfPCell createBarcode(String code) throws DocumentException,        IOException {
BarcodeEAN barcode = new BarcodeEAN();
barcode.setCodeType(Barcode.EAN13);
barcode.setCode(code);
PdfPCell cell = new PdfPCell(barcode.createImageWithBarcode(writer.getDirectContent(), BaseColor.BLACK, BaseColor.GRAY), true);
cell.setBorderWidth(0.1f);
cell.setPadding(10);
return cell;
}

要创建条形码,我要调用以下函数:

createBarcode(String.format("%013d", 1));

我可能在哪里错了?

0 个答案:

没有答案