Package com.itextpdf.signatures
Class PdfSignatureAppearance
java.lang.Object
com.itextpdf.signatures.PdfSignatureAppearance
Provides convenient methods to make a signature appearance. Use it in conjunction with
PdfSigner
.
-
Nested Class Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
PdfSignatureAppearance
(PdfDocument document, Rectangle pageRect, int pageNumber) Creates a PdfSignatureAppearance. -
Method Summary
Modifier and TypeMethodDescriptionprotected PdfFormXObject
Deprecated.Deprecated.in favour ofSignedAppearanceText
that should be used forSignatureFieldAppearance
.Deprecated.UsePdfSigner.getContact()
instead.getImage()
Deprecated.float
Deprecated.Deprecated.will be deleted in the next major release.Deprecated.will be deleted in the next major release.Deprecated.in favour ofSignatureFieldAppearance
.Deprecated.in favour ofSignatureFieldAppearance
.float
Deprecated.in favour ofSignatureFieldAppearance
.Deprecated.in favour ofSignatureFieldAppearance
.Deprecated.won't be public in the next major release.int
Deprecated.won't be public in the next major release.Deprecated.won't be public in the next major release.Deprecated.won't be public in the next major release.Deprecated.in favour ofSignatureFieldAppearance
, rendering mode will be detected depending on specifiedsetContent
method parameters.Gets the signature layout element.Deprecated.UsePdfSigner.getSignatureCreator()
instead.Deprecated.in favour ofSignatureFieldAppearance
.protected Calendar
Deprecated.usePdfSigner.getSignDate()
instead.boolean
Deprecated.won't be public in the next major release.setCertificate
(Certificate signCertificate) Deprecated.in favour ofSignedAppearanceText
that should be used forSignatureFieldAppearance
.setContact
(String contact) Deprecated.UsePdfSigner.setContact(String)
instead.protected PdfSignatureAppearance
setFieldName
(String fieldName) Set the field name of the appearance.setFontFamily
(String... fontFamilyNames) Deprecated.in favour ofElementPropertyContainer.setFontFamily(String...)
.setFontProvider
(FontProvider fontProvider) Deprecated.in favour ofElementPropertyContainer.setProperty(int, Object)
.Deprecated.setImageScale
(float imageScale) Deprecated.setLayer2Font
(PdfFont font) Deprecated.in favour ofElementPropertyContainer.setFont(PdfFont)
.setLayer2FontColor
(Color color) Deprecated.in favour ofElementPropertyContainer.setFontColor(Color)
.setLayer2FontSize
(float fontSize) Deprecated.in favour ofElementPropertyContainer.setFontSize(float)
.setLayer2Text
(String text) Deprecated.in favour ofSignatureFieldAppearance
.setLocation
(String location) Deprecated.won't be public in the next major release.setLocationCaption
(String locationCaption) Deprecated.in favour ofSignedAppearanceText
that should be used forSignatureFieldAppearance
.setPageNumber
(int pageNumber) Deprecated.won't be public in the next major release.setPageRect
(Rectangle pageRect) Deprecated.won't be public in the next major release.Deprecated.won't be public in the next major release.setReasonCaption
(String reasonCaption) Deprecated.in favour ofSignedAppearanceText
that should be used forSignatureFieldAppearance
.setRenderingMode
(PdfSignatureAppearance.RenderingMode renderingMode) Deprecated.in favour ofSignatureFieldAppearance
, rendering mode will be detected depending on specifiedsetContent
method parameters.setReuseAppearance
(boolean reuseAppearance) Deprecated.in favour ofPdfSignatureFormField.setReuseAppearance(boolean)
.setSignatureAppearance
(SignatureFieldAppearance modelElement) Deprecated.setSignatureCreator
(String signatureCreator) Deprecated.UsePdfSigner.setSignatureCreator(String)
instead.setSignatureGraphic
(ImageData signatureGraphic) Deprecated.protected PdfSignatureAppearance
setSignDate
(Calendar signDate) Deprecated.usePdfSigner.setSignDate(Calendar)
instead.
-
Constructor Details
-
PdfSignatureAppearance
Creates a PdfSignatureAppearance.- Parameters:
-
document
- PdfDocument -
pageRect
- Rectangle of the appearance -
pageNumber
- Number of the page the appearance should be on
-
-
Method Details
-
getPageNumber
Deprecated.won't be public in the next major release. UsePdfSigner.getPageNumber()
instead.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
Deprecated.won't be public in the next major release. UsePdfSigner.setPageNumber(int)
instead.Sets the page number of the signature field which this signature appearance is associated with. Implicitly callssetPageRect(com.itextpdf.kernel.geom.Rectangle)
which considers page number to process the rectangle correctly.- Parameters:
-
pageNumber
- The page number of the signature field which this signature appearance is associated with. - Returns:
- this instance to support fluent interface.
-
getPageRect
Deprecated.won't be public in the next major release. UsePdfSigner.getPageRect()
instead.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
Deprecated.won't be public in the next major release. UsePdfSigner.setPageRect(Rectangle)
instead.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.
-
getLayer0
Deprecated.will be deleted in the next major release. SeePdfSignatureFormField.setBackgroundLayer(PdfFormXObject)
. Note that it should be called for the field retrieved withPdfSigner.getSignatureField()
method.Get Layer 0 of the appearance.The size of the layer is determined by the rectangle set via
setPageRect(Rectangle)
- Returns:
- layer 0.
-
getLayer2
Deprecated.will be deleted in the next major release. SeePdfSignatureFormField.setSignatureAppearanceLayer(PdfFormXObject)
. Note that it should be called for the field retrieved withPdfSigner.getSignatureField()
method.Get Layer 2 of the appearance.The size of the layer is determined by the rectangle set via
setPageRect(Rectangle)
- Returns:
- layer 2.
-
getRenderingMode
Deprecated.in favour ofSignatureFieldAppearance
, rendering mode will be detected depending on specifiedsetContent
method parameters.Gets the rendering mode for this signature.- Returns:
- the rendering mode for this signature.
-
setRenderingMode
@Deprecated public PdfSignatureAppearance setRenderingMode(PdfSignatureAppearance.RenderingMode renderingMode) Deprecated.in favour ofSignatureFieldAppearance
, rendering mode will be detected depending on specifiedsetContent
method parameters.Sets the rendering mode for this signature.- Parameters:
-
renderingMode
- the rendering mode. - Returns:
- this instance to support fluent interface.
-
getReason
Deprecated.won't be public in the next major release. UsePdfSigner.getReason()
instead.Returns the signing reason.- Returns:
- reason for signing.
-
setReason
Deprecated.won't be public in the next major release. UsePdfSigner.setReason(java.lang.String)
instead.Sets the signing reason.- Parameters:
-
reason
- signing reason. - Returns:
- this instance to support fluent interface.
-
setReasonCaption
Deprecated.in favour ofSignedAppearanceText
that should be used forSignatureFieldAppearance
.Sets the caption for the signing reason.- Parameters:
-
reasonCaption
- A new signing reason caption. - Returns:
- this instance to support fluent interface.
-
getLocation
Deprecated.won't be public in the next major release. UsePdfSigner.getLocation()
instead.Returns the signing location.- Returns:
- signing location.
-
setLocation
Deprecated.won't be public in the next major release. UsePdfSigner.setLocation(java.lang.String)
instead.Sets the signing location.- Parameters:
-
location
- A new signing location. - Returns:
- this instance to support fluent interface.
-
setLocationCaption
Deprecated.in favour ofSignedAppearanceText
that should be used forSignatureFieldAppearance
.Sets the caption for the signing location.- Parameters:
-
locationCaption
- A new signing location caption. - Returns:
- this instance to support fluent interface.
-
getSignatureCreator
Deprecated.UsePdfSigner.getSignatureCreator()
instead.Returns the signature creator.- Returns:
- The signature creator.
-
setSignatureCreator
Deprecated.UsePdfSigner.setSignatureCreator(String)
instead.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
Deprecated.UsePdfSigner.getContact()
instead.Returns the signing contact.- Returns:
- The signing contact.
-
setContact
Deprecated.UsePdfSigner.setContact(String)
instead.Sets the signing contact.- Parameters:
-
contact
- A new signing contact. - Returns:
- this instance to support fluent interface.
-
setCertificate
Deprecated.in favour ofSignedAppearanceText
that should be used forSignatureFieldAppearance
. Specified certificate provides signer name.Sets the certificate used to provide the text in the appearance. This certificate doesn't take part in the actual signing process.- Parameters:
-
signCertificate
- the certificate. - Returns:
- this instance to support fluent interface.
-
getCertificate
Deprecated.in favour ofSignedAppearanceText
that should be used forSignatureFieldAppearance
.Get the signing certificate.- Returns:
- the signing certificate.
-
getSignatureGraphic
Deprecated.in favour ofSignatureFieldAppearance
.Gets the Image object to render.- Returns:
- the image.
-
setSignatureGraphic
Deprecated.Sets the Image object to render when Render is set to RenderingMode.GRAPHIC or RenderingMode.GRAPHIC_AND_DESCRIPTION.- Parameters:
-
signatureGraphic
- image rendered. If null the mode is defaulted to RenderingMode.DESCRIPTION - Returns:
- this instance to support fluent interface.
-
setReuseAppearance
Deprecated.in favour ofPdfSignatureFormField.setReuseAppearance(boolean)
. Note that it should be called for the field retrieved withPdfSigner.getSignatureField()
method.Indicates that the existing appearances needs to be reused as a background layer.- Parameters:
-
reuseAppearance
- is an appearances reusing flag value to set. - Returns:
- this instance to support fluent interface.
-
getImage
Deprecated.Gets the background image for the layer 2.- Returns:
- the background image for the layer 2.
-
setImage
Deprecated.Sets the background image for the text in the layer 2.- Parameters:
-
image
- the background image for the layer 2. - Returns:
- this instance to support fluent interface.
-
getImageScale
Deprecated.Gets the scaling to be applied to the background image.- Returns:
- the scaling to be applied to the background image.
-
setImageScale
Deprecated.Sets the scaling to be applied to the background image. If it's zero the image will fully fill the rectangle. If it's less than zero the image will fill the rectangle but will keep the proportions. If it's greater than zero that scaling will be applied. In any of the cases the image will always be centered. It's zero by default.- Parameters:
-
imageScale
- the scaling to be applied to the background image. - Returns:
- this instance to support fluent interface.
-
setLayer2Text
Deprecated.in favour ofSignatureFieldAppearance
.Sets the signature text identifying the signer.- Parameters:
-
text
- the signature text identifying the signer. If null or not set a standard description will be used. - Returns:
- this instance to support fluent interface.
-
getLayer2Text
Deprecated.in favour ofSignatureFieldAppearance
.Gets the signature text identifying the signer if set by setLayer2Text().- Returns:
- the signature text identifying the signer.
-
getLayer2Font
Deprecated.in favour ofSignatureFieldAppearance
.Gets the n2 and n4 layer font.- Returns:
- the n2 and n4 layer font.
-
setLayer2Font
Deprecated.in favour ofElementPropertyContainer.setFont(PdfFont)
.Sets the n2 layer font. If the font size is zero, auto-fit will be used.- Parameters:
-
font
- the n2 font. - Returns:
- this instance to support fluent interface.
-
setLayer2FontSize
Deprecated.in favour ofElementPropertyContainer.setFontSize(float)
.Sets the n2 and n4 layer font size.- Parameters:
-
fontSize
- font size. - Returns:
- this instance to support fluent interface.
-
getLayer2FontSize
Deprecated.in favour ofSignatureFieldAppearance
.Gets the n2 and n4 layer font size.- Returns:
- the n2 and n4 layer font size.
-
setLayer2FontColor
Deprecated.in favour ofElementPropertyContainer.setFontColor(Color)
.Sets the n2 and n4 layer font color.- Parameters:
-
color
- font color. - Returns:
- this instance to support fluent interface.
-
getLayer2FontColor
Deprecated.in favour ofSignatureFieldAppearance
.Gets the n2 layer font color.- Returns:
- the n2 layer font color.
-
getSignatureAppearance
Gets the signature layout element.- Returns:
- the signature layout element.
-
setSignatureAppearance
@Deprecated public PdfSignatureAppearance setSignatureAppearance(SignatureFieldAppearance modelElement) Deprecated.Sets the signature layout element.- Parameters:
-
modelElement
- the signature layout element. - Returns:
- this instance to support fluent interface.
-
setFontProvider
Deprecated.in favour ofElementPropertyContainer.setProperty(int, Object)
.SetsFontProvider
. Note, font provider is inherited property.- Parameters:
-
fontProvider
- the instance ofFontProvider
. - Returns:
- this instance to support fluent interface.
-
setFontFamily
Deprecated.in favour ofElementPropertyContainer.setFontFamily(String...)
.Sets the preferable font families for the signature content. Note thatFontProvider
shall be set as well.- Parameters:
-
fontFamilyNames
- defines an ordered list of preferable font families for the signature element. - Returns:
- this instance to support fluent interface.
-
isInvisible
Deprecated.won't be public in the next major release.Gets the visibility status of the signature.- Returns:
- the visibility status of the signature.
-
getAppearance
Deprecated.in favour ofSignatureFieldAppearance
. Shouldn't be used.Constructs appearance (top-level) for a signature.- Returns:
- a top-level signature appearance.
- Throws:
-
IOException
- if font cannot be created. - See Also:
-
getSignDate
Deprecated.usePdfSigner.getSignDate()
instead.Returns the signature date.- Returns:
- the signature date.
-
setSignDate
Deprecated.usePdfSigner.setSignDate(Calendar)
instead.Sets the signature date.- Parameters:
-
signDate
- A new signature date. - Returns:
- this instance to support fluent interface.
-
setFieldName
Set the field name of the appearance. Field name indicates the field to be signed if it is already presented in the document (signing existing field). Required for reuseAppearance option.- Parameters:
-
fieldName
- name of the field - Returns:
- this instance to support fluent interface
-
SignatureFieldAppearance
.