Package com.itextpdf.forms.form.element
Class SignatureFieldAppearance
- java.lang.Object
-
- com.itextpdf.commons.actions.sequence.AbstractIdentifiableElement
-
- com.itextpdf.layout.ElementPropertyContainer<T>
-
- com.itextpdf.layout.element.AbstractElement<T>
-
- com.itextpdf.forms.form.element.FormField<SignatureFieldAppearance>
-
- com.itextpdf.forms.form.element.SignatureFieldAppearance
-
- All Implemented Interfaces:
IFormField,IAbstractElement,IBlockElement,IElement,IPropertyContainer,IAccessibleElement
public class SignatureFieldAppearance extends FormField<SignatureFieldAppearance>
Extension of theFormFieldclass representing a signature field in PDF.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<IElement>contentElementsCollection of the layout elements which will be rendered as a signature content.private static floatDEFAULT_PADDINGDefault paddings for the signature field.private java.lang.StringidWithDotsWe should support signing of existing fields with dots in name, but dots are now allowed in model element id.private SignedAppearanceTextsignedAppearanceTextprivate java.lang.StringsignerName-
Fields inherited from class com.itextpdf.forms.form.element.FormField
tagProperties
-
Fields inherited from class com.itextpdf.layout.element.AbstractElement
childElements, nextRenderer, styles
-
Fields inherited from class com.itextpdf.layout.ElementPropertyContainer
properties
-
-
Constructor Summary
Constructors Constructor Description SignatureFieldAppearance(java.lang.String id)Creates a newSignatureFieldAppearanceinstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddImageContent(ImageData imageData)private voidaddTextContent(int index, java.lang.String text)private voidaddTextContent(java.lang.String text)AccessibilityPropertiesgetAccessibilityProperties()Gets theaccessibility properties.java.util.List<IElement>getContentElements()Gets the final content for this signature.java.lang.StringgetId()Gets the id.SignedAppearanceTextgetSignedAppearanceText()Gets theSignedAppearanceTextinstance for this signature.protected IRenderermakeNewRenderer()Creates a new renderer instance.private voidprepareContent(java.lang.String signer, SignedAppearanceText description)SignatureFieldAppearancesetContent(SignedAppearanceText description)Sets the content for this signature.SignatureFieldAppearancesetContent(SignedAppearanceText description, ImageData image)Sets the content for this signature.SignatureFieldAppearancesetContent(ImageData image)Sets the content for this signature.SignatureFieldAppearancesetContent(Div data)Sets the content for this signature.SignatureFieldAppearancesetContent(java.lang.String description)Sets the content for this signature.SignatureFieldAppearancesetContent(java.lang.String signerName, SignedAppearanceText description)Sets the content for this signature.SignatureFieldAppearancesetContent(java.lang.String description, ImageData image)Sets the content for this signature.SignatureFieldAppearancesetContent(java.lang.String signerName, java.lang.String description)Sets the content for this signature.voidsetSignerName(java.lang.String signerName)Replaces the signer name for this signature if it was set bysetContent(com.itextpdf.forms.fields.properties.SignedAppearanceText).-
Methods inherited from class com.itextpdf.forms.form.element.FormField
getDefaultProperty, setAlternativeDescription, setHeight, setInteractive, setSize, setValue, setWidth
-
Methods inherited from class com.itextpdf.layout.element.AbstractElement
addStyle, createRendererSubTree, getChildren, getProperty, getRenderer, hasProperty, isEmpty, setAction, setNextRenderer, setPageNumber
-
Methods inherited from class com.itextpdf.layout.ElementPropertyContainer
deleteOwnProperty, getOwnProperty, getSplitCharacters, getStrokeColor, getStrokeWidth, getTextRenderingMode, getTransparentStrokeColor, hasOwnProperty, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundImage, setBackgroundImage, setBaseDirection, setBorder, setBorderBottom, setBorderBottomLeftRadius, setBorderBottomRightRadius, setBorderLeft, setBorderRadius, setBorderRight, setBorderTop, setBorderTopLeftRadius, setBorderTopRightRadius, setCharacterSpacing, setDashPattern, setDestination, setFixedPosition, setFixedPosition, setFixedPosition, setFixedPosition, setFont, setFontColor, setFontColor, setFontColor, setFontFamily, setFontFamily, setFontKerning, setFontScript, setFontSize, setHorizontalAlignment, setHyphenation, setLineThrough, setOpacity, setProperty, setRelativePosition, setSplitCharacters, setStrokeColor, setStrokeColor, setStrokeColor, setStrokeWidth, setTextAlignment, setTextRenderingMode, setUnderline, setUnderline, setUnderline, setUnderline, setUnderline, setWordSpacing, simulateBold, simulateItalic
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.itextpdf.layout.element.IAbstractElement
getChildren
-
Methods inherited from interface com.itextpdf.layout.element.IElement
createRendererSubTree, getRenderer, setNextRenderer
-
Methods inherited from interface com.itextpdf.layout.IPropertyContainer
deleteOwnProperty, getOwnProperty, getProperty, hasOwnProperty, hasProperty, setProperty
-
-
-
-
Field Detail
-
DEFAULT_PADDING
private static final float DEFAULT_PADDING
Default paddings for the signature field.- See Also:
- Constant Field Values
-
contentElements
private final java.util.List<IElement> contentElements
Collection of the layout elements which will be rendered as a signature content.
-
signedAppearanceText
private SignedAppearanceText signedAppearanceText
-
signerName
private java.lang.String signerName
-
idWithDots
private java.lang.String idWithDots
We should support signing of existing fields with dots in name, but dots are now allowed in model element id. So it is a placeholder for such cases.
-
-
Constructor Detail
-
SignatureFieldAppearance
public SignatureFieldAppearance(java.lang.String id)
Creates a newSignatureFieldAppearanceinstance.- Parameters:
id- signature field name if you use thisSignatureFieldAppearancein pure layout for the new interactive signature field creation. ID will be ignored if thisSignatureFieldAppearanceis used for signing or for existing signature field
-
-
Method Detail
-
setContent
public SignatureFieldAppearance setContent(SignedAppearanceText description)
Sets the content for this signature.- Parameters:
description-SignedAppearanceTextinstance representing the signature text identifying the signer.- Returns:
- this same
SignatureFieldAppearanceinstance.
-
setContent
public SignatureFieldAppearance setContent(java.lang.String description)
Sets the content for this signature.- Parameters:
description- the signature text identifying the signer.- Returns:
- this same
SignatureFieldAppearanceinstance.
-
setContent
public SignatureFieldAppearance setContent(SignedAppearanceText description, ImageData image)
Sets the content for this signature.- Parameters:
description-SignedAppearanceTextinstance representing the signature text identifying the signer.image- the Image object to render.- Returns:
- this same
SignatureFieldAppearanceinstance.
-
setContent
public SignatureFieldAppearance setContent(java.lang.String description, ImageData image)
Sets the content for this signature.- Parameters:
description- the signature text identifying the signer.image- the Image object to render.- Returns:
- this same
SignatureFieldAppearanceinstance.
-
setContent
public SignatureFieldAppearance setContent(ImageData image)
Sets the content for this signature.- Parameters:
image- the Image object to render.- Returns:
- this same
SignatureFieldAppearanceinstance.
-
setContent
public SignatureFieldAppearance setContent(java.lang.String signerName, SignedAppearanceText description)
Sets the content for this signature.- Parameters:
signerName- the name of the signer from the certificate.description-SignedAppearanceTextinstance representing the signature text identifying the signer.- Returns:
- this same
SignatureFieldAppearanceinstance.
-
setContent
public SignatureFieldAppearance setContent(java.lang.String signerName, java.lang.String description)
Sets the content for this signature.- Parameters:
signerName- the name of the signer from the certificate.description- the signature text identifying the signer.- Returns:
- this same
SignatureFieldAppearanceinstance.
-
setContent
public SignatureFieldAppearance setContent(Div data)
Sets the content for this signature.- Parameters:
data- the custom signature data which will be rendered.- Returns:
- this same
SignatureFieldAppearanceinstance.
-
getContentElements
public java.util.List<IElement> getContentElements()
Gets the final content for this signature.- Returns:
- collection of the layout elements which will be rendered as a signature content.
-
getSignedAppearanceText
public SignedAppearanceText getSignedAppearanceText()
Gets theSignedAppearanceTextinstance for this signature.- Returns:
SignedAppearanceTextinstance if it was set bysetContent(com.itextpdf.forms.fields.properties.SignedAppearanceText), null otherwise.
-
setSignerName
public void setSignerName(java.lang.String signerName)
Replaces the signer name for this signature if it was set bysetContent(com.itextpdf.forms.fields.properties.SignedAppearanceText).- Parameters:
signerName- signer name to set.
-
getId
public java.lang.String getId()
Gets the id.- Specified by:
getIdin interfaceIFormField- Overrides:
getIdin classFormField<SignatureFieldAppearance>- Returns:
- the id
-
getAccessibilityProperties
public AccessibilityProperties getAccessibilityProperties()
Gets theaccessibility properties. See alsoIAccessibleElement.- Returns:
- an interface that allows to specify properties of a tagged element in Tagged PDF.
-
makeNewRenderer
protected IRenderer makeNewRenderer()
Creates a new renderer instance.- Specified by:
makeNewRendererin classAbstractElement<SignatureFieldAppearance>- Returns:
- new
IRenderer
-
prepareContent
private void prepareContent(java.lang.String signer, SignedAppearanceText description)
-
addTextContent
private void addTextContent(java.lang.String text)
-
addTextContent
private void addTextContent(int index, java.lang.String text)
-
addImageContent
private void addImageContent(ImageData imageData)
-
-