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 theFormField
class representing a signature field in PDF.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<IElement>
contentElements
Collection of the layout elements which will be rendered as a signature content.private static float
DEFAULT_PADDING
Default paddings for the signature field.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.private SignedAppearanceText
signedAppearanceText
private java.lang.String
signerName
-
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 newSignatureFieldAppearance
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addImageContent(ImageData imageData)
private void
addTextContent(int index, java.lang.String text)
private void
addTextContent(java.lang.String text)
AccessibilityProperties
getAccessibilityProperties()
Gets theaccessibility properties
.java.util.List<IElement>
getContentElements()
Gets the final content for this signature.java.lang.String
getId()
Gets the id.SignedAppearanceText
getSignedAppearanceText()
Gets theSignedAppearanceText
instance for this signature.protected IRenderer
makeNewRenderer()
Creates a new renderer instance.private void
prepareContent(java.lang.String signer, SignedAppearanceText description)
SignatureFieldAppearance
setContent(SignedAppearanceText description)
Sets the content for this signature.SignatureFieldAppearance
setContent(SignedAppearanceText description, ImageData image)
Sets the content for this signature.SignatureFieldAppearance
setContent(ImageData image)
Sets the content for this signature.SignatureFieldAppearance
setContent(Div data)
Sets the content for this signature.SignatureFieldAppearance
setContent(java.lang.String description)
Sets the content for this signature.SignatureFieldAppearance
setContent(java.lang.String signerName, SignedAppearanceText description)
Sets the content for this signature.SignatureFieldAppearance
setContent(java.lang.String description, ImageData image)
Sets the content for this signature.SignatureFieldAppearance
setContent(java.lang.String signerName, java.lang.String description)
Sets the content for this signature.void
setSignerName(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 newSignatureFieldAppearance
instance.- Parameters:
id
- signature field name if you use thisSignatureFieldAppearance
in pure layout for the new interactive signature field creation. ID will be ignored if thisSignatureFieldAppearance
is used for signing or for existing signature field
-
-
Method Detail
-
setContent
public SignatureFieldAppearance setContent(SignedAppearanceText description)
Sets the content for this signature.- Parameters:
description
-SignedAppearanceText
instance representing the signature text identifying the signer.- Returns:
- this same
SignatureFieldAppearance
instance.
-
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
SignatureFieldAppearance
instance.
-
setContent
public SignatureFieldAppearance setContent(SignedAppearanceText description, ImageData image)
Sets the content for this signature.- Parameters:
description
-SignedAppearanceText
instance representing the signature text identifying the signer.image
- the Image object to render.- Returns:
- this same
SignatureFieldAppearance
instance.
-
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
SignatureFieldAppearance
instance.
-
setContent
public SignatureFieldAppearance setContent(ImageData image)
Sets the content for this signature.- Parameters:
image
- the Image object to render.- Returns:
- this same
SignatureFieldAppearance
instance.
-
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
-SignedAppearanceText
instance representing the signature text identifying the signer.- Returns:
- this same
SignatureFieldAppearance
instance.
-
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
SignatureFieldAppearance
instance.
-
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
SignatureFieldAppearance
instance.
-
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 theSignedAppearanceText
instance for this signature.- Returns:
SignedAppearanceText
instance 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:
getId
in interfaceIFormField
- Overrides:
getId
in 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:
makeNewRenderer
in 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)
-
-