List of usage examples for com.lowagie.text.pdf BarcodeInter25 setGenerateChecksum
public void setGenerateChecksum(boolean generateChecksum)
From source file:classroom.filmfestival_c.Movies23.java
public static void fillForm(String filename, AccreditationData data, OutputStream out) throws IOException, DocumentException { PdfReader reader = new PdfReader(filename); PdfStamper stamper = new PdfStamper(reader, out); AcroFields form = stamper.getAcroFields(); form.setField("name", data.getName()); form.setFieldProperty("type", "textcolor", data.getTypeColor(), null); form.setField("type", data.getTypeName()); form.setField("number", data.getNumber(false)); form.setFieldProperty("filmfestival", "bgcolor", data.getTypeColor(), null); form.regenerateField("filmfestival"); if (data.getPhoto() != null) { PushbuttonField bt = form.getNewPushbuttonFromField("photo"); bt.setLayout(PushbuttonField.LAYOUT_ICON_ONLY); bt.setProportionalIcon(true);/*from ww w . j a va2s .c om*/ bt.setImage(data.getPhoto()); form.replacePushbuttonField("photo", bt.getField()); } try { BarcodeInter25 code = new BarcodeInter25(); code.setGenerateChecksum(true); code.setBarHeight(mm2pt(3)); code.setCode(data.getNumber(true)); code.setFont(null); PdfContentByte cb = new PdfContentByte(stamper.getWriter()); PdfTemplate template = code.createTemplateWithBarcode(cb, null, null); PushbuttonField bt = form.getNewPushbuttonFromField("barcode"); bt.setLayout(PushbuttonField.LAYOUT_ICON_ONLY); bt.setProportionalIcon(false); bt.setTemplate(template); form.replacePushbuttonField("barcode", bt.getField()); } catch (Exception e) { // not a valid code, do nothing } stamper.setFormFlattening(data.isFlatten()); stamper.close(); }