/** Gets the <CODE>AcroFields</CODE> object that allows to get and set field values * and to merge FDF forms. * @return the <CODE>AcroFields</CODE> object */ public AcroFields getAcroFields() { return stamper.getAcroFields(); }
/** Gets the <CODE>AcroFields</CODE> object that allows to get and set field values * and to merge FDF forms. * @return the <CODE>AcroFields</CODE> object */ public AcroFields getAcroFields() { return stamper.getAcroFields(); }
boolean partialFormFlattening(String name) { getAcroFields(); if (acroFields.getXfa().isXfaPresent()) throw new UnsupportedOperationException(MessageLocalization.getComposedMessage("partial.form.flattening.is.not.supported.with.xfa.forms")); if (!acroFields.getFields().containsKey(name)) return false; partialFlattening.add(name); return true; }
boolean partialFormFlattening(String name) { getAcroFields(); if (acroFields.getXfa().isXfaPresent()) throw new UnsupportedOperationException(MessageLocalization.getComposedMessage("partial.form.flattening.is.not.supported.with.xfa.forms")); if (!acroFields.getFields().containsKey(name)) return false; partialFlattening.add(name); return true; }
/** * Gets a new signature field name that * doesn't clash with any existing name. * @return a new signature field name */ public String getNewSigName() { AcroFields af = writer.getAcroFields(); String name = "Signature"; int step = 0; boolean found = false; while (!found) { ++step; String n1 = name + step; if (af.getFieldItem(n1) != null) continue; n1 += "."; found = true; for (Object element : af.getFields().keySet()) { String fn = (String)element; if (fn.startsWith(n1)) { found = false; break; } } } name += step; return name; }
/** * Gets a new signature field name that * doesn't clash with any existing name. * @return a new signature field name */ public String getNewSigName() { AcroFields af = writer.getAcroFields(); String name = "Signature"; int step = 0; boolean found = false; while (!found) { ++step; String n1 = name + step; if (af.getFieldItem(n1) != null) continue; n1 += "."; found = true; for (Object element : af.getFields().keySet()) { String fn = (String)element; if (fn.startsWith(n1)) { found = false; break; } } } name += step; return name; }
/** * Sets the signature to be visible. It creates a new visible signature field. * @param pageRect the position and dimension of the field in the page * @param page the page to place the field. The fist page is 1 * @param fieldName the field name or <CODE>null</CODE> to generate automatically a new field name */ public void setVisibleSignature(Rectangle pageRect, int page, String fieldName) { if (fieldName != null) { if (fieldName.indexOf('.') >= 0) throw new IllegalArgumentException(MessageLocalization.getComposedMessage("field.names.cannot.contain.a.dot")); AcroFields af = writer.getAcroFields(); AcroFields.Item item = af.getFieldItem(fieldName); if (item != null) throw new IllegalArgumentException(MessageLocalization.getComposedMessage("the.field.1.already.exists", fieldName)); this.fieldName = fieldName; } if (page < 1 || page > writer.reader.getNumberOfPages()) throw new IllegalArgumentException(MessageLocalization.getComposedMessage("invalid.page.number.1", page)); this.pageRect = new Rectangle(pageRect); this.pageRect.normalize(); rect = new Rectangle(this.pageRect.getWidth(), this.pageRect.getHeight()); this.page = page; }
/** * Sets the signature to be visible. It creates a new visible signature field. * @param pageRect the position and dimension of the field in the page * @param page the page to place the field. The fist page is 1 * @param fieldName the field name or <CODE>null</CODE> to generate automatically a new field name */ public void setVisibleSignature(Rectangle pageRect, int page, String fieldName) { if (fieldName != null) { if (fieldName.indexOf('.') >= 0) throw new IllegalArgumentException(MessageLocalization.getComposedMessage("field.names.cannot.contain.a.dot")); AcroFields af = writer.getAcroFields(); AcroFields.Item item = af.getFieldItem(fieldName); if (item != null) throw new IllegalArgumentException(MessageLocalization.getComposedMessage("the.field.1.already.exists", fieldName)); this.fieldName = fieldName; } if (page < 1 || page > writer.reader.getNumberOfPages()) throw new IllegalArgumentException(MessageLocalization.getComposedMessage("invalid.page.number.1", page)); this.pageRect = new Rectangle(pageRect); this.pageRect.normalize(); rect = new Rectangle(this.pageRect.getWidth(), this.pageRect.getHeight()); this.page = page; }
stamper.mergeVerification(); preClosed = true; AcroFields af = writer.getAcroFields(); String name = getFieldName(); boolean fieldExists = af.doesSignatureFieldExist(name);
stamper.mergeVerification(); preClosed = true; AcroFields af = writer.getAcroFields(); String name = getFieldName(); boolean fieldExists = af.doesSignatureFieldExist(name);
if (annot.isForm()) { fieldsAdded = true; getAcroFields(); PdfFormField field = (PdfFormField) annot; if (field.getParent() != null)
AcroFields af = writer.getAcroFields(); AcroFields.Item item = af.getFieldItem(fieldName); if (item == null)
AcroFields af = writer.getAcroFields(); AcroFields.Item item = af.getFieldItem(fieldName); if (item == null)
if (annot.isForm()) { fieldsAdded = true; getAcroFields(); PdfFormField field = (PdfFormField) annot; if (field.getParent() != null)
protected void flatFields() { if (append) throw new IllegalArgumentException(MessageLocalization.getComposedMessage("field.flattening.is.not.supported.in.append.mode")); getAcroFields(); Map<String, Item> fields = acroFields.getFields(); if (fieldsAdded && partialFlattening.isEmpty()) {
frm.concatCTM(0, -1, 1, 0, 0, rect.getWidth()); if (reuseAppearance) { AcroFields af = writer.getAcroFields(); PdfIndirectReference ref = af.getNormalAppearance(getFieldName()); if (ref != null) {
protected void flatFields() { if (append) throw new IllegalArgumentException(MessageLocalization.getComposedMessage("field.flattening.is.not.supported.in.append.mode")); getAcroFields(); Map<String, Item> fields = acroFields.getFields(); if (fieldsAdded && partialFlattening.isEmpty()) {
frm.concatCTM(0, -1, 1, 0, 0, rect.getWidth()); if (reuseAppearance) { AcroFields af = writer.getAcroFields(); PdfIndirectReference ref = af.getNormalAppearance(getFieldName()); if (ref != null) {