use of com.itextpdf.barcodes.BarcodeEAN in project betca-tpv-spring by miw-upm.
the class PdfTag24Builder method addTag24.
public PdfTag24Builder addTag24(String description, String code) {
assert description != null;
assert code != null;
if ((tag24 % 24) == 0) {
if (tag24 > 0) {
this.getDocument().add(new AreaBreak(AreaBreakType.NEXT_PAGE));
}
this.prepareTags24();
}
Cell cell = new Cell();
cell.setPaddingTop(10);
cell.setMinHeight(84.2F);
cell.setBorder(Border.NO_BORDER);
cell.setTextAlignment(TextAlignment.CENTER);
cell.add(description);
if (!code.isEmpty()) {
BarcodeEAN barcode = new BarcodeEAN(this.getDocument().getPdfDocument());
barcode.setCodeType(BarcodeEAN.EAN13);
barcode.setCode(code.trim());
Image barcodeImage = new Image(barcode.createFormXObject(this.getDocument().getPdfDocument()));
barcodeImage.setWidthPercent(70);
barcodeImage.setHorizontalAlignment(HorizontalAlignment.CENTER);
cell.add(barcodeImage);
}
this.getTable().addCell(cell);
this.getDocument().add(this.getTable());
tag24++;
return this;
}
Aggregations