Class SignerProperties
- java.lang.Object
-
- com.itextpdf.signatures.SignerProperties
-
public class SignerProperties extends java.lang.ObjectProperties to be used in signing operations.
-
-
Field Summary
Fields Modifier and Type Field Description private SignatureFieldAppearanceappearanceprivate AccessPermissionscertificationLevelprivate java.lang.Stringcontactprivate PdfSigFieldLockfieldLockprivate java.lang.StringfieldNamestatic java.lang.StringIGNORED_IDThis string could be used to create theSignatureFieldAppearanceinstance which will be used for signing since its ID will be ignored anyway in that case, and specified ID won't override the field name.private java.lang.Stringlocationprivate intpageNumberprivate RectanglepageRectprivate java.lang.Stringreasonprivate java.lang.StringsignatureCreatorprivate java.util.CalendarsignDate
-
Constructor Summary
Constructors Constructor Description SignerProperties()Create instance ofSignerProperties.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AccessPermissionsgetCertificationLevel()Returns the document's certification level.java.util.CalendargetClaimedSignDate()Gets the signature date.java.lang.StringgetContact()Returns the signing contact.PdfSigFieldLockgetFieldLockDict()Getter for the field lock dictionary.java.lang.StringgetFieldName()Gets the field name.java.lang.StringgetLocation()Returns the signing location.intgetPageNumber()Provides the page number of the signature field which this signature appearance is associated with.RectanglegetPageRect()Provides the rectangle that represent the position and dimension of the signature field in the page.java.lang.StringgetReason()Returns the signing reason.SignatureFieldAppearancegetSignatureAppearance()Gets signature field appearance object representing the appearance of the signature.java.lang.StringgetSignatureCreator()Returns the signature creator.SignerPropertiessetCertificationLevel(AccessPermissions accessPermissions)Sets the document's certification level.SignerPropertiessetClaimedSignDate(java.util.Calendar signDate)Sets the signature date.SignerPropertiessetContact(java.lang.String contact)Sets the signing contact.SignerPropertiessetFieldLockDict(PdfSigFieldLock fieldLock)Setter for the field lock dictionary.SignerPropertiessetFieldName(java.lang.String fieldName)Sets the name indicating the field to be signed.SignerPropertiessetLocation(java.lang.String location)Sets the signing location.SignerPropertiessetPageNumber(int pageNumber)Sets the page number of the signature field which this signature appearance is associated with.SignerPropertiessetPageRect(Rectangle pageRect)Sets the rectangle that represent the position and dimension of the signature field in the page.SignerPropertiessetReason(java.lang.String reason)Sets the signing reason.SignerPropertiessetSignatureAppearance(SignatureFieldAppearance appearance)Sets the signature field layout element to customize the appearance of the signature.SignerPropertiessetSignatureCreator(java.lang.String signatureCreator)Sets the name of the application used to create the signature.
-
-
-
Field Detail
-
IGNORED_ID
public static final java.lang.String IGNORED_ID
This string could be used to create theSignatureFieldAppearanceinstance which will be used for signing since its ID will be ignored anyway in that case, and specified ID won't override the field name.
-
fieldLock
private PdfSigFieldLock fieldLock
-
appearance
private SignatureFieldAppearance appearance
-
signDate
private java.util.Calendar signDate
-
certificationLevel
private AccessPermissions certificationLevel
-
fieldName
private java.lang.String fieldName
-
pageNumber
private int pageNumber
-
pageRect
private Rectangle pageRect
-
signatureCreator
private java.lang.String signatureCreator
-
contact
private java.lang.String contact
-
reason
private java.lang.String reason
-
location
private java.lang.String location
-
-
Constructor Detail
-
SignerProperties
public SignerProperties()
Create instance ofSignerProperties.
-
-
Method Detail
-
getClaimedSignDate
public java.util.Calendar getClaimedSignDate()
Gets the signature date.- Returns:
- calendar set to the signature date
-
setClaimedSignDate
public SignerProperties setClaimedSignDate(java.util.Calendar signDate)
Sets the signature date.- Parameters:
signDate- the signature date- Returns:
- this instance to support fluent interface
-
setSignatureAppearance
public SignerProperties setSignatureAppearance(SignatureFieldAppearance appearance)
Sets the signature field layout element to customize the appearance of the signature. ID specified forSignatureFieldAppearancewill be ignored and won't override field name, soIGNORED_IDcould be used. To specify signature name usesetFieldName(java.lang.String).Note that if
SignedAppearanceTextwas set as the content (or part of the content) forSignatureFieldAppearanceobject,PdfSignerproperties such as signing date, reason, location and signer name could be set automatically.In case you create new signature field (either using
setFieldName(java.lang.String)with the name that doesn't exist in the document or do not specifying it at all) then the signature is invisible by default. UsesetPageRect(Rectangle)andsetPageNumber(int)to provide the rectangle that represent the position and dimension of the signature field in the specified page.It is possible to set other appearance related properties such as
PdfSignatureFormField.setReuseAppearance(boolean),PdfSignatureFormField.setBackgroundLayer(com.itextpdf.kernel.pdf.xobject.PdfFormXObject)(n0 layer) andPdfSignatureFormField.setSignatureAppearanceLayer(com.itextpdf.kernel.pdf.xobject.PdfFormXObject)(n2 layer) for the signature field usingPdfSigner.getSignatureField(). Page, rectangle and other properties could be also set up viaSignerProperties.- Parameters:
appearance- theSignatureFieldAppearancelayout element representing signature appearance- Returns:
- this instance to support fluent interface
-
getSignatureAppearance
public SignatureFieldAppearance getSignatureAppearance()
Gets signature field appearance object representing the appearance of the signature.To customize the signature appearance, create new
SignatureFieldAppearanceobject and set it usingsetSignatureAppearance(SignatureFieldAppearance).- Returns:
SignatureFieldAppearanceobject representing signature appearance
-
getCertificationLevel
public AccessPermissions getCertificationLevel()
Returns the document's certification level. For possible values seeAccessPermissions.- Returns:
AccessPermissionsenum which specifies which certification level shall be used
-
setCertificationLevel
public SignerProperties setCertificationLevel(AccessPermissions accessPermissions)
Sets the document's certification level.- Parameters:
accessPermissions-AccessPermissionsenum which specifies which certification level shall be used- Returns:
- this instance to support fluent interface
-
getFieldName
public java.lang.String getFieldName()
Gets the field name.- Returns:
- the field name
-
setFieldName
public SignerProperties setFieldName(java.lang.String fieldName)
Sets the name indicating the field to be signed. The field can already be presented in the document but shall not be signed. If the field is not presented in the document, it will be created.Note that ID specified for
SignatureFieldAppearanceset bysetSignatureAppearance(com.itextpdf.forms.form.element.SignatureFieldAppearance)will be ignored and won't override the field name.- Parameters:
fieldName- the name indicating the field to be signed- Returns:
- this instance to support fluent interface
-
getPageNumber
public int getPageNumber()
Provides the page number of the signature field which this signature appearance is associated with.- Returns:
- the page number of the signature field which this signature appearance is associated with
-
setPageNumber
public SignerProperties setPageNumber(int pageNumber)
Sets the page number of the signature field which this signature appearance is associated with.- Parameters:
pageNumber- the page number of the signature field which this signature appearance is associated with- Returns:
- this instance to support fluent interface
-
getPageRect
public Rectangle getPageRect()
Provides the rectangle that represent the position and dimension of the signature field in the page.- Returns:
- the rectangle that represent the position and dimension of the signature field in the page
-
setPageRect
public SignerProperties setPageRect(Rectangle pageRect)
Sets the rectangle that represent the position and dimension of the signature field in the page.- Parameters:
pageRect- the rectangle that represents the position and dimension of the signature field in the page- Returns:
- this instance to support fluent interface
-
getFieldLockDict
public PdfSigFieldLock getFieldLockDict()
Getter for the field lock dictionary.- Returns:
- field lock dictionary
-
setFieldLockDict
public SignerProperties setFieldLockDict(PdfSigFieldLock fieldLock)
Setter for the field lock dictionary.Be aware: if a signature is created on an existing signature field, then its /Lock dictionary takes the precedence (if it exists).
- Parameters:
fieldLock- field lock dictionary- Returns:
- this instance to support fluent interface
-
getSignatureCreator
public java.lang.String getSignatureCreator()
Returns the signature creator.- Returns:
- the signature creator
-
setSignatureCreator
public SignerProperties setSignatureCreator(java.lang.String signatureCreator)
Sets the name of the application used to create the signature.- Parameters:
signatureCreator- A new name of the application signing a document.- Returns:
- this instance to support fluent interface.
-
getContact
public java.lang.String getContact()
Returns the signing contact.- Returns:
- the signing contact
-
setContact
public SignerProperties setContact(java.lang.String contact)
Sets the signing contact.- Parameters:
contact- a new signing contact- Returns:
- this instance to support fluent interface
-
getReason
public java.lang.String getReason()
Returns the signing reason.- Returns:
- the signing reason
-
setReason
public SignerProperties setReason(java.lang.String reason)
Sets the signing reason.- Parameters:
reason- a new signing reason- Returns:
- this instance to support fluent interface
-
getLocation
public java.lang.String getLocation()
Returns the signing location.- Returns:
- the signing location
-
setLocation
public SignerProperties setLocation(java.lang.String location)
Sets the signing location.- Parameters:
location- a new signing location- Returns:
- this instance to support fluent interface
-
-