Table of Contents

Class PdfSignatureAppearance

Namespace
iText.Signatures
Assembly
itext.sign.dll

Provides convenient methods to make a signature appearance.

public class PdfSignatureAppearance
Inheritance
PdfSignatureAppearance
Inherited Members

Remarks

Provides convenient methods to make a signature appearance. Use it in conjunction with PdfSigner.

Constructors

PdfSignatureAppearance(PdfDocument, Rectangle, int)

Creates a PdfSignatureAppearance.

protected PdfSignatureAppearance(PdfDocument document, Rectangle pageRect, int pageNumber)

Parameters

document PdfDocument

PdfDocument

pageRect Rectangle

Rectangle of the appearance

pageNumber int

Number of the page the appearance should be on

Methods

GetAppearance()

Constructs appearance (top-level) for a signature.

[Obsolete("in favour of iText.Forms.Form.Element.SignatureFieldAppearance . Shouldn't be used.")]
protected virtual PdfFormXObject GetAppearance()

Returns

PdfFormXObject

a top-level signature appearance.

GetCertificate()

Get the signing certificate.

[Obsolete("in favour of iText.Forms.Fields.Properties.SignedAppearanceText that should be used for iText.Forms.Form.Element.SignatureFieldAppearance .")]
public virtual IX509Certificate GetCertificate()

Returns

IX509Certificate

the signing certificate.

GetContact()

Returns the signing contact.

[Obsolete("Use PdfSigner.GetContact() instead.")]
public virtual string GetContact()

Returns

string

The signing contact.

GetImage()

Gets the background image for the layer 2.

[Obsolete("in favour of iText.Layout.ElementPropertyContainer{T}.SetBackgroundImage(iText.Layout.Properties.BackgroundImage) .")]
public virtual ImageData GetImage()

Returns

ImageData

the background image for the layer 2.

GetImageScale()

Gets the scaling to be applied to the background image.

[Obsolete("in favour of iText.Layout.ElementPropertyContainer{T}.SetBackgroundImage(iText.Layout.Properties.BackgroundImage) .")]
public virtual float GetImageScale()

Returns

float

the scaling to be applied to the background image.

GetLayer0()

Get Layer 0 of the appearance.

[Obsolete("will be deleted in the next major release. See iText.Forms.Fields.PdfSignatureFormField.SetBackgroundLayer(iText.Kernel.Pdf.Xobject.PdfFormXObject) . Note that it should be called for the field retrieved with PdfSigner.GetSignatureField() method.")]
public virtual PdfFormXObject GetLayer0()

Returns

PdfFormXObject

layer 0.

Remarks

Get Layer 0 of the appearance.

The size of the layer is determined by the rectangle set via SetPageRect(Rectangle)

GetLayer2()

Get Layer 2 of the appearance.

[Obsolete("will be deleted in the next major release. See iText.Forms.Fields.PdfSignatureFormField.SetSignatureAppearanceLayer(iText.Kernel.Pdf.Xobject.PdfFormXObject) . Note that it should be called for the field retrieved with PdfSigner.GetSignatureField() method.")]
public virtual PdfFormXObject GetLayer2()

Returns

PdfFormXObject

layer 2.

Remarks

Get Layer 2 of the appearance.

The size of the layer is determined by the rectangle set via SetPageRect(Rectangle)

GetLayer2Font()

Gets the n2 and n4 layer font.

[Obsolete("in favour of iText.Forms.Form.Element.SignatureFieldAppearance .")]
public virtual PdfFont GetLayer2Font()

Returns

PdfFont

the n2 and n4 layer font.

GetLayer2FontColor()

Gets the n2 layer font color.

[Obsolete("in favour of iText.Forms.Form.Element.SignatureFieldAppearance .")]
public virtual Color GetLayer2FontColor()

Returns

Color

the n2 layer font color.

GetLayer2FontSize()

Gets the n2 and n4 layer font size.

[Obsolete("in favour of iText.Forms.Form.Element.SignatureFieldAppearance .")]
public virtual float GetLayer2FontSize()

Returns

float

the n2 and n4 layer font size.

GetLayer2Text()

Gets the signature text identifying the signer if set by setLayer2Text().

[Obsolete("in favour of iText.Forms.Form.Element.SignatureFieldAppearance .")]
public virtual string GetLayer2Text()

Returns

string

the signature text identifying the signer.

GetLocation()

Returns the signing location.

[Obsolete("won't be public in the next major release. Use PdfSigner.GetLocation() instead.")]
public virtual string GetLocation()

Returns

string

signing location.

GetPageNumber()

Provides the page number of the signature field which this signature appearance is associated with.

[Obsolete("won't be public in the next major release. Use PdfSigner.GetPageNumber() instead.")]
public virtual int GetPageNumber()

Returns

int

The page number of the signature field which this signature appearance is associated with.

GetPageRect()

Provides the rectangle that represent the position and dimension of the signature field in the page.

[Obsolete("won't be public in the next major release. Use PdfSigner.GetPageRect() instead.")]
public virtual Rectangle GetPageRect()

Returns

Rectangle

the rectangle that represent the position and dimension of the signature field in the page.

GetReason()

Returns the signing reason.

[Obsolete("won't be public in the next major release. Use PdfSigner.GetReason() instead.")]
public virtual string GetReason()

Returns

string

reason for signing.

GetRenderingMode()

Gets the rendering mode for this signature.

[Obsolete("in favour of iText.Forms.Form.Element.SignatureFieldAppearance , rendering mode will be detected depending on specifiedsetContent method parameters.")]
public virtual PdfSignatureAppearance.RenderingMode GetRenderingMode()

Returns

PdfSignatureAppearance.RenderingMode

the rendering mode for this signature.

GetSignDate()

Returns the signature date.

[Obsolete("use PdfSigner.GetSignDate() instead.")]
protected virtual DateTime GetSignDate()

Returns

DateTime

the signature date.

GetSignatureAppearance()

Gets the signature layout element.

public virtual SignatureFieldAppearance GetSignatureAppearance()

Returns

SignatureFieldAppearance

the signature layout element.

GetSignatureCreator()

Returns the signature creator.

[Obsolete("Use PdfSigner.GetSignatureCreator() instead.")]
public virtual string GetSignatureCreator()

Returns

string

The signature creator.

GetSignatureGraphic()

Gets the Image object to render.

[Obsolete("in favour of iText.Forms.Form.Element.SignatureFieldAppearance .")]
public virtual ImageData GetSignatureGraphic()

Returns

ImageData

the image.

IsInvisible()

Gets the visibility status of the signature.

[Obsolete("won't be public in the next major release.")]
public virtual bool IsInvisible()

Returns

bool

the visibility status of the signature.

SetCertificate(IX509Certificate)

Sets the certificate used to provide the text in the appearance.

[Obsolete("in favour of iText.Forms.Fields.Properties.SignedAppearanceText that should be used for iText.Forms.Form.Element.SignatureFieldAppearance . Specified certificate provides signer name.")]
public virtual PdfSignatureAppearance SetCertificate(IX509Certificate signCertificate)

Parameters

signCertificate IX509Certificate

the certificate.

Returns

PdfSignatureAppearance

this instance to support fluent interface.

Remarks

Sets the certificate used to provide the text in the appearance. This certificate doesn't take part in the actual signing process.

SetContact(string)

Sets the signing contact.

[Obsolete("Use PdfSigner.SetContact(System.String) instead.")]
public virtual PdfSignatureAppearance SetContact(string contact)

Parameters

contact string

A new signing contact.

Returns

PdfSignatureAppearance

this instance to support fluent interface.

SetFieldName(string)

Set the field name of the appearance.

protected virtual PdfSignatureAppearance SetFieldName(string fieldName)

Parameters

fieldName string

name of the field

Returns

PdfSignatureAppearance

this instance to support fluent interface

Remarks

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.

SetFontFamily(params string[])

Sets the preferable font families for the signature content.

[Obsolete("in favour of iText.Layout.ElementPropertyContainer{T}.SetFontFamily(System.String[]) .")]
public virtual PdfSignatureAppearance SetFontFamily(params string[] fontFamilyNames)

Parameters

fontFamilyNames string[]

defines an ordered list of preferable font families for the signature element.

Returns

PdfSignatureAppearance

this instance to support fluent interface.

Remarks

Sets the preferable font families for the signature content. Note that FontProvider shall be set as well.

SetFontProvider(FontProvider)

[Obsolete("in favour of iText.Layout.ElementPropertyContainer{T}.SetProperty(int, System.Object) .")]
public virtual PdfSignatureAppearance SetFontProvider(FontProvider fontProvider)

Parameters

fontProvider FontProvider

the instance of FontProvider.

Returns

PdfSignatureAppearance

this instance to support fluent interface.

Remarks

Sets FontProvider . Note, font provider is inherited property.

SetImage(ImageData)

Sets the background image for the text in the layer 2.

[Obsolete("in favour of iText.Layout.ElementPropertyContainer{T}.SetBackgroundImage(iText.Layout.Properties.BackgroundImage) .")]
public virtual PdfSignatureAppearance SetImage(ImageData image)

Parameters

image ImageData

the background image for the layer 2.

Returns

PdfSignatureAppearance

this instance to support fluent interface.

SetImageScale(float)

Sets the scaling to be applied to the background image.

[Obsolete("in favour of iText.Layout.ElementPropertyContainer{T}.SetBackgroundImage(iText.Layout.Properties.BackgroundImage) .")]
public virtual PdfSignatureAppearance SetImageScale(float imageScale)

Parameters

imageScale float

the scaling to be applied to the background image.

Returns

PdfSignatureAppearance

this instance to support fluent interface.

Remarks

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.

SetLayer2Font(PdfFont)

Sets the n2 layer font.

[Obsolete("in favour of iText.Layout.ElementPropertyContainer{T}.SetFont(iText.Kernel.Font.PdfFont) .")]
public virtual PdfSignatureAppearance SetLayer2Font(PdfFont font)

Parameters

font PdfFont

the n2 font.

Returns

PdfSignatureAppearance

this instance to support fluent interface.

Remarks

Sets the n2 layer font. If the font size is zero, auto-fit will be used.

SetLayer2FontColor(Color)

Sets the n2 and n4 layer font color.

[Obsolete("in favour of iText.Layout.ElementPropertyContainer{T}.SetFontColor(iText.Kernel.Colors.Color) .")]
public virtual PdfSignatureAppearance SetLayer2FontColor(Color color)

Parameters

color Color

font color.

Returns

PdfSignatureAppearance

this instance to support fluent interface.

SetLayer2FontSize(float)

Sets the n2 and n4 layer font size.

[Obsolete("in favour of iText.Layout.ElementPropertyContainer{T}.SetFontSize(float) .")]
public virtual PdfSignatureAppearance SetLayer2FontSize(float fontSize)

Parameters

fontSize float

font size.

Returns

PdfSignatureAppearance

this instance to support fluent interface.

SetLayer2Text(string)

Sets the signature text identifying the signer.

[Obsolete("in favour of iText.Forms.Form.Element.SignatureFieldAppearance .")]
public virtual PdfSignatureAppearance SetLayer2Text(string text)

Parameters

text string

the signature text identifying the signer. If null or not set a standard description will be used.

Returns

PdfSignatureAppearance

this instance to support fluent interface.

SetLocation(string)

Sets the signing location.

[Obsolete("won't be public in the next major release. Use PdfSigner.SetLocation(System.String) instead.")]
public virtual PdfSignatureAppearance SetLocation(string location)

Parameters

location string

A new signing location.

Returns

PdfSignatureAppearance

this instance to support fluent interface.

SetLocationCaption(string)

Sets the caption for the signing location.

[Obsolete("in favour of iText.Forms.Fields.Properties.SignedAppearanceText that should be used for iText.Forms.Form.Element.SignatureFieldAppearance .")]
public virtual PdfSignatureAppearance SetLocationCaption(string locationCaption)

Parameters

locationCaption string

A new signing location caption.

Returns

PdfSignatureAppearance

this instance to support fluent interface.

SetPageNumber(int)

Sets the page number of the signature field which this signature appearance is associated with.

[Obsolete("won't be public in the next major release. Use PdfSigner.SetPageNumber(int) instead.")]
public virtual PdfSignatureAppearance SetPageNumber(int pageNumber)

Parameters

pageNumber int

The page number of the signature field which this signature appearance is associated with.

Returns

PdfSignatureAppearance

this instance to support fluent interface.

Remarks

Sets the page number of the signature field which this signature appearance is associated with. Implicitly calls SetPageRect(Rectangle) which considers page number to process the rectangle correctly.

SetPageRect(Rectangle)

Sets the rectangle that represent the position and dimension of the signature field in the page.

[Obsolete("won't be public in the next major release. Use PdfSigner.SetPageRect(iText.Kernel.Geom.Rectangle) instead.")]
public virtual PdfSignatureAppearance SetPageRect(Rectangle pageRect)

Parameters

pageRect Rectangle

The rectangle that represents the position and dimension of the signature field in the page.

Returns

PdfSignatureAppearance

this instance to support fluent interface.

SetReason(string)

Sets the signing reason.

[Obsolete("won't be public in the next major release. Use PdfSigner.SetReason(System.String) instead.")]
public virtual PdfSignatureAppearance SetReason(string reason)

Parameters

reason string

signing reason.

Returns

PdfSignatureAppearance

this instance to support fluent interface.

SetReasonCaption(string)

Sets the caption for the signing reason.

[Obsolete("in favour of iText.Forms.Fields.Properties.SignedAppearanceText that should be used for iText.Forms.Form.Element.SignatureFieldAppearance .")]
public virtual PdfSignatureAppearance SetReasonCaption(string reasonCaption)

Parameters

reasonCaption string

A new signing reason caption.

Returns

PdfSignatureAppearance

this instance to support fluent interface.

SetRenderingMode(RenderingMode)

Sets the rendering mode for this signature.

[Obsolete("in favour of iText.Forms.Form.Element.SignatureFieldAppearance , rendering mode will be detected depending on specifiedsetContent method parameters.")]
public virtual PdfSignatureAppearance SetRenderingMode(PdfSignatureAppearance.RenderingMode renderingMode)

Parameters

renderingMode PdfSignatureAppearance.RenderingMode

the rendering mode.

Returns

PdfSignatureAppearance

this instance to support fluent interface.

SetReuseAppearance(bool)

Indicates that the existing appearances needs to be reused as a background layer.

[Obsolete("in favour of iText.Forms.Fields.PdfSignatureFormField.SetReuseAppearance(bool) . Note that it should be called for the field retrieved with PdfSigner.GetSignatureField() method.")]
public virtual PdfSignatureAppearance SetReuseAppearance(bool reuseAppearance)

Parameters

reuseAppearance bool

is an appearances reusing flag value to set.

Returns

PdfSignatureAppearance

this instance to support fluent interface.

SetSignDate(DateTime)

Sets the signature date.

[Obsolete("use PdfSigner.SetSignDate(System.DateTime) instead.")]
protected virtual PdfSignatureAppearance SetSignDate(DateTime signDate)

Parameters

signDate DateTime

A new signature date.

Returns

PdfSignatureAppearance

this instance to support fluent interface.

SetSignatureAppearance(SignatureFieldAppearance)

Sets the signature layout element.

[Obsolete("Use PdfSigner.SetSignatureAppearance(iText.Forms.Form.Element.SignatureFieldAppearance) instead.")]
public virtual PdfSignatureAppearance SetSignatureAppearance(SignatureFieldAppearance modelElement)

Parameters

modelElement SignatureFieldAppearance

the signature layout element.

Returns

PdfSignatureAppearance

this instance to support fluent interface.

SetSignatureCreator(string)

Sets the name of the application used to create the signature.

[Obsolete("Use PdfSigner.SetSignatureCreator(System.String) instead.")]
public virtual PdfSignatureAppearance SetSignatureCreator(string signatureCreator)

Parameters

signatureCreator string

A new name of the application signing a document.

Returns

PdfSignatureAppearance

this instance to support fluent interface.

SetSignatureGraphic(ImageData)

Sets the Image object to render when Render is set to RenderingMode.GRAPHIC or RenderingMode.GRAPHIC_AND_DESCRIPTION.

[Obsolete("in favour of iText.Forms.Form.Element.SignatureFieldAppearance.SetContent(iText.IO.Image.ImageData) oriText.Forms.Form.Element.SignatureFieldAppearance.SetContent(System.String, iText.IO.Image.ImageData) .")]
public virtual PdfSignatureAppearance SetSignatureGraphic(ImageData signatureGraphic)

Parameters

signatureGraphic ImageData

image rendered. If null the mode is defaulted to RenderingMode.DESCRIPTION

Returns

PdfSignatureAppearance

this instance to support fluent interface.