/** * Sets the default value of this field to be the given signature. * * @param value is the PDSignatureField */ public void setDefaultValue(PDSignature value) { getCOSObject().setItem(COSName.DV, value); }
/** * <p>(Optional; PDF 1.) A seed value dictionary containing information * that constrains the properties of a signature that is applied to the * field.</p> * * @param sv is the seed value dictionary as PDSeedValue */ public void setSeedValue(PDSeedValue sv) { if (sv != null) { getCOSObject().setItem(COSName.SV, sv); } }
/** * Check if the field already exists in the field list. * * @param fieldIterator iterator on all fields. * @param signatureField the signature field. * @return true if the field already existed in the field list, false if not. */ private boolean checkSignatureField(Iterator<PDField> fieldIterator, PDSignatureField signatureField) { while (fieldIterator.hasNext()) { PDField field = fieldIterator.next(); if (field instanceof PDSignatureField && field.getCOSObject().equals(signatureField.getCOSObject())) { return true; } } return false; }
/** * Sets the value of this field to be the given signature. * * @param value is the PDSignatureField */ public void setValue(PDSignature value) throws IOException { getCOSObject().setItem(COSName.V, value); applyChange(); }
/** * Returns the signature contained in this field. * * @return A signature dictionary. */ public PDSignature getValue() { COSBase value = getCOSObject().getDictionaryObject(COSName.V); if (value instanceof COSDictionary) { return new PDSignature((COSDictionary)value); } return null; }
/** * Returns the default value, if any. * * @return A signature dictionary. */ public PDSignature getDefaultValue() { COSBase value = getCOSObject().getDictionaryObject(COSName.DV); if (value == null) { return null; } return new PDSignature((COSDictionary)value); }
/** * <p>(Optional; PDF 1.5) A seed value dictionary containing information * that constrains the properties of a signature that is applied to the * field.</p> * * @return the seed value dictionary as PDSeedValue */ public PDSeedValue getSeedValue() { COSDictionary dict = (COSDictionary) getCOSObject().getDictionaryObject(COSName.SV); PDSeedValue sv = null; if (dict != null) { sv = new PDSeedValue(dict); } return sv; }
/** * Retrieve all signature dictionaries from the document. * * @return a <code>List</code> of <code>PDSignatureField</code>s */ public List<PDSignature> getSignatureDictionaries() { List<PDSignature> signatures = new ArrayList<>(); for (PDSignatureField field : getSignatureFields()) { COSBase value = field.getCOSObject().getDictionaryObject(COSName.V); if (value instanceof COSDictionary) { signatures.add(new PDSignature((COSDictionary)value)); } } return signatures; }
/** * @see PDTerminalField#PDTerminalField(PDAcroForm) * * @param acroForm The acroForm for this field. */ public PDSignatureField(PDAcroForm acroForm) { super(acroForm); getCOSObject().setItem(COSName.FT, COSName.SIG); getWidgets().get(0).setLocked(true); getWidgets().get(0).setPrinted(true); setPartialName(generatePartialName()); }
private PDSignature findExistingSignature(PDAcroForm acroForm, String sigFieldName) { PDSignature signature = null; PDSignatureField signatureField; if (acroForm != null) { signatureField = (PDSignatureField) acroForm.getField(sigFieldName); if (signatureField != null) { // retrieve signature dictionary signature = signatureField.getSignature(); if (signature == null) { signature = new PDSignature(); // after solving PDFBOX-3524 // signatureField.setValue(signature) // until then: signatureField.getCOSObject().setItem(COSName.V, signature); } else { throw new IllegalStateException("The signature field " + sigFieldName + " is already signed."); } } } return signature; }
private PDSignature findExistingSignature(PDDocument doc, String sigFieldName) { PDSignature signature = null; PDSignatureField signatureField; PDAcroForm acroForm = doc.getDocumentCatalog().getAcroForm(); if (acroForm != null) { signatureField = (PDSignatureField) acroForm.getField(sigFieldName); if (signatureField != null) { // retrieve signature dictionary signature = signatureField.getSignature(); if (signature == null) { signature = new PDSignature(); // after solving PDFBOX-3524 // signatureField.setValue(signature) // until then: signatureField.getCOSObject().setItem(COSName.V, signature); } else { throw new IllegalStateException("The signature field " + sigFieldName + " is already signed."); } } } return signature; }
/** * Sets the default value of this field to be the given signature. * * @param value is the PDSignatureField */ public void setDefaultValue(PDSignature value) throws IOException { getCOSObject().setItem(COSName.DV, value); }
/** * Sets the default value of this field to be the given signature. * * @param value is the PDSignatureField */ public void setDefaultValue(PDSignature value) throws IOException { getCOSObject().setItem(COSName.DV, value); }
/** * <p>(Optional; PDF 1.) A seed value dictionary containing information * that constrains the properties of a signature that is applied to the * field.</p> * * @param sv is the seed value dictionary as PDSeedValue */ public void setSeedValue(PDSeedValue sv) { if (sv != null) { getCOSObject().setItem(COSName.SV, sv); } }
/** * <p>(Optional; PDF 1.) A seed value dictionary containing information * that constrains the properties of a signature that is applied to the * field.</p> * * @param sv is the seed value dictionary as PDSeedValue */ public void setSeedValue(PDSeedValue sv) { if (sv != null) { getCOSObject().setItem(COSName.SV, sv); } }
if (checkFields) signatureField.getCOSObject().setNeedToBeUpdated(true);
/** * Sets the value of this field to be the given signature. * * @param value is the PDSignatureField */ public void setValue(PDSignature value) throws IOException { getCOSObject().setItem(COSName.V, value); applyChange(); }
/** * Returns the default value, if any. * * @return A signature dictionary. */ public PDSignature getDefaultValue() { COSBase value = getCOSObject().getDictionaryObject(COSName.DV); if (value == null) { return null; } return new PDSignature((COSDictionary)value); }
/** * Sets the value of this field to be the given signature. * * @param value is the PDSignatureField */ public void setValue(PDSignature value) throws IOException { getCOSObject().setItem(COSName.V, value); applyChange(); }
/** * Returns the signature contained in this field. * * @return A signature dictionary. */ public PDSignature getValue() { COSBase value = getCOSObject().getDictionaryObject(COSName.V); if (value == null) { return null; } return new PDSignature((COSDictionary)value); }