Document document = new Document(PageSize.A4.rotate(), 0, 0, 0, 0); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(savePath)); document.open(); PdfPTable ta = new PdfPTable(39); ............... ............... PdfContentByte cd = writer.getDirectContent(); Barcode128 code128 = new Barcode128(); code128.setCodeType(code128.CODE128); code128.setCode(“12312312312”); code128.setBarHeight(10); Image image128 = code128.createImageWithBarcode(cd, null, null); PdfPCell row1_cell_1 = new PdfPCell(image128); ta.addCell(row1_cell_1);
解决方案