Question

I am using iText for java. I am trying to create a Code128 barcode with a FNC3 character at the beginning of the barcode. Can anyone help me with this? Here is my code:

try {
Barcode128 barcode = new Barcode128();
barcode.setCode((char)228 + "92");
Image img = barcode.createAwtImage(Color.black, Color.white);
lblBarcode.setIcon(new ImageIcon(img));

}
catch(Exception ex) {
  ex.printStackTrace();
}
Was it helpful?

Solution

To have a code that starts with FNC3 use barcode.setCode(""+FNC3+<rest of barcode>). The FNC3 constant is located in com.itextpdf.text.pdf.Barcode

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top