someone know how to save a thirteen digit number in a variable? Because I need to increase the number of my barcode after each use.
So I want to safe the barcode number in a variable and increse it after each if-clause.
public void actionPerformed(ActionEvent arg0) {
if (hochfrequent = false) {
Document document = new Document(PageSize.A4, 50, 50, 50, 50);
try {
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("BarcodeArtikel.pdf"));
document.open();
PdfContentByte cb = writer.getDirectContent();
String code = "1234567812345";
// int code1= 1234567812345;
BarcodeEAN codeEAN = new BarcodeEAN();
codeEAN.setCodeType(Barcode.EAN13);
codeEAN.setCode(code);
Image imageEAN = codeEAN.createImageWithBarcode(cb, null, null);
document.add(new Phrase(new Chunk(imageEAN, 0, 0)));
}
catch (Exception de) {
de.printStackTrace();
}
document.close();
}
}}
Thanks for helping me! the return of the methode is the barcode in a pdf file.