List of usage examples for com.lowagie.text.pdf Barcode128 CODE_C
char CODE_C
To view the source code for com.lowagie.text.pdf Barcode128 CODE_C.
Click Source Link
From source file:be.fedict.eid.applet.service.impl.PdfGenerator.java
License:Open Source License
/** * Generate a Code128C barcode//from www. j a va 2s . c o m * * @param rrn unique Rijksregister number * @param cardNumber number of the card * @return Image containing barcode * @throws IOException * @throws BadElementException */ private Image createBarcodeImage(String rrn, String cardNumber) throws IOException, BadElementException { if (null == rrn || rrn.length() != 11 || null == cardNumber || cardNumber.length() < 9) { throw new IllegalArgumentException("Missing or invalid length for RRN or Card Number"); } String lastDigits = cardNumber.substring(cardNumber.length() - 9); String code = rrn + lastDigits; Barcode128 barcode = new Barcode128(); barcode.setCodeType(Barcode128.CODE_C); barcode.setCode(code); barcode.setFont(null); return Image.getInstance(barcode.createAwtImage(Color.BLACK, Color.WHITE), null, true); }