/** * Refreshes the appearance streams and appearance dictionaries for * the widget annotations of all fields. * * @throws IOException */ public void refreshAppearances() throws IOException { for (PDField field : getFieldTree()) { if (field instanceof PDTerminalField) { ((PDTerminalField) field).constructAppearances(); } } }
/** * This will tell this form to cache the fields into a Map structure * for fast access via the getField method. The default is false. You would * want this to be false if you were changing the COSDictionary behind the scenes, * otherwise setting this to true is acceptable. * * @param cache A boolean telling if we should cache the fields. */ public void setCacheFields(boolean cache) { if (cache) { fieldCache = new HashMap<>(); for (PDField field : getFieldTree()) { fieldCache.put(field.getFullyQualifiedName(), field); } } else { fieldCache = null; } }
/** * This will get a field by name, possibly using the cache if setCache is true. * * @param fullyQualifiedName The name of the field to get. * @return The field with that name of null if one was not found. */ public PDField getField(String fullyQualifiedName) { // get the field from the cache if there is one. if (fieldCache != null) { return fieldCache.get(fullyQualifiedName); } // get the field from the field tree for (PDField field : getFieldTree()) { if (field.getFullyQualifiedName().equals(fullyQualifiedName)) { return field; } } return null; }
/** * Retrieve all signature fields from the document. * * @return a <code>List</code> of <code>PDSignatureField</code>s */ public List<PDSignatureField> getSignatureFields() { List<PDSignatureField> fields = new ArrayList<>(); PDAcroForm acroForm = getDocumentCatalog().getAcroForm(); if (acroForm != null) { for (PDField field : acroForm.getFieldTree()) { if (field instanceof PDSignatureField) { fields.add((PDSignatureField)field); } } } return fields; }
for (PDField field: getFieldTree())
private void initRectMap() { PDAcroForm acroForm = document.getDocumentCatalog().getAcroForm(); if (acroForm == null) { return; } for (PDField field : acroForm.getFieldTree()) { String fullyQualifiedName = field.getFullyQualifiedName(); for (PDAnnotationWidget widget : field.getWidgets()) { if (page.equals(widget.getPage())) { rectMap.put(widget.getRectangle(), fullyQualifiedName); } } } }
final int prefixLength = prefix.length(); for (PDField destField : destAcroForm.getFieldTree())
List<String> getFormFieldNamesFancy(PDDocument pdDocument) { PDAcroForm pdAcroForm = pdDocument.getDocumentCatalog().getAcroForm(); if (pdAcroForm == null) return Collections.emptyList(); return StreamSupport.stream(pdAcroForm.getFieldTree().spliterator(), false) .filter(field -> (field instanceof PDTerminalField)) .map(field -> field.getFullyQualifiedName()) .collect(Collectors.toList()); }
/** * Refreshes the appearance streams and appearance dictionaries for * the widget annotations of all fields. * * @throws IOException */ public void refreshAppearances() throws IOException { for (PDField field : getFieldTree()) { if (field instanceof PDTerminalField) { ((PDTerminalField) field).constructAppearances(); } } }
/** * Refreshes the appearance streams and appearance dictionaries for * the widget annotations of all fields. * * @throws IOException */ public void refreshAppearances() throws IOException { for (PDField field : getFieldTree()) { if (field instanceof PDTerminalField) { ((PDTerminalField) field).constructAppearances(); } } }
/** * This will get a field by name, possibly using the cache if setCache is true. * * @param fullyQualifiedName The name of the field to get. * @return The field with that name of null if one was not found. */ public PDField getField(String fullyQualifiedName) { // get the field from the cache if there is one. if (fieldCache != null) { return fieldCache.get(fullyQualifiedName); } // get the field from the field tree for (PDField field : getFieldTree()) { if (field.getFullyQualifiedName().equals(fullyQualifiedName)) { return field; } } return null; }
/** * This will get a field by name, possibly using the cache if setCache is true. * * @param fullyQualifiedName The name of the field to get. * @return The field with that name of null if one was not found. */ public PDField getField(String fullyQualifiedName) { // get the field from the cache if there is one. if (fieldCache != null) { return fieldCache.get(fullyQualifiedName); } // get the field from the field tree for (PDField field : getFieldTree()) { if (field.getFullyQualifiedName().equals(fullyQualifiedName)) { return field; } } return null; }
/** * This will tell this form to cache the fields into a Map structure * for fast access via the getField method. The default is false. You would * want this to be false if you were changing the COSDictionary behind the scenes, * otherwise setting this to true is acceptable. * * @param cache A boolean telling if we should cache the fields. */ public void setCacheFields(boolean cache) { if (cache) { fieldCache = new HashMap<String, PDField>(); for (PDField field : getFieldTree()) { fieldCache.put(field.getFullyQualifiedName(), field); } } else { fieldCache = null; } }
/** * This will tell this form to cache the fields into a Map structure * for fast access via the getField method. The default is false. You would * want this to be false if you were changing the COSDictionary behind the scenes, * otherwise setting this to true is acceptable. * * @param cache A boolean telling if we should cache the fields. */ public void setCacheFields(boolean cache) { if (cache) { fieldCache = new HashMap<>(); for (PDField field : getFieldTree()) { fieldCache.put(field.getFullyQualifiedName(), field); } } else { fieldCache = null; } }
List<String> getFormFieldNames(PDDocument pdDocument) { PDAcroForm pdAcroForm = pdDocument.getDocumentCatalog().getAcroForm(); if (pdAcroForm == null) return Collections.emptyList(); List<String> result = new ArrayList<>(); for (PDField pdField : pdAcroForm.getFieldTree()) { if (pdField instanceof PDTerminalField) { result.add(pdField.getFullyQualifiedName()); } } return result; }
/** * Retrieve all signature fields from the document. * * @return a <code>List</code> of <code>PDSignatureField</code>s * @throws IOException if no document catalog can be found. */ public List<PDSignatureField> getSignatureFields() throws IOException { List<PDSignatureField> fields = new ArrayList<PDSignatureField>(); PDAcroForm acroForm = getDocumentCatalog().getAcroForm(); if (acroForm != null) { for (PDField field : acroForm.getFieldTree()) { if (field instanceof PDSignatureField) { fields.add((PDSignatureField)field); } } } return fields; }
/** * Retrieve all signature fields from the document. * * @return a <code>List</code> of <code>PDSignatureField</code>s * @throws IOException if no document catalog can be found. */ public List<PDSignatureField> getSignatureFields() throws IOException { List<PDSignatureField> fields = new ArrayList<>(); PDAcroForm acroForm = getDocumentCatalog().getAcroForm(); if (acroForm != null) { for (PDField field : acroForm.getFieldTree()) { if (field instanceof PDSignatureField) { fields.add((PDSignatureField)field); } } } return fields; }
for (PDField field: getFieldTree())
for (PDField field: getFieldTree())
final int prefixLength = prefix.length(); for (PDField destField : destAcroForm.getFieldTree()) for (PDField srcField : srcAcroForm.getFieldTree())