HiraokaHyperTools.iTextSharp-LGPL  0.2.5
iTextSharp.text.pdf.PdfSignatureAppearance Class Reference

Classes

class  FRangeStream
 
interface  ISignatureEvent
 

Public Types

enum class  SignatureRender { Description , NameAndDescription , GraphicAndDescription }
 

Public Member Functions

bool IsInvisible ()
 
void SetCrypto (ICipherParameters privKey, X509Certificate[] certChain, object[] crlList, PdfName filter)
 
void SetVisibleSignature (Rectangle pageRect, int page, String fieldName)
 
void SetVisibleSignature (String fieldName)
 
PdfTemplate GetLayer (int layer)
 
PdfTemplate GetTopLayer ()
 
PdfTemplate GetAppearance ()
 
void SetExternalDigest (byte[] digest, byte[] RSAdata, String digestEncryptionAlgorithm)
 
bool IsNewField ()
 
String GetNewSigName ()
 
void PreClose ()
 
void PreClose (Hashtable exclusionSizes)
 
void Close (PdfDictionary update)
 
bool IsPreClosed ()
 
Image GetImage ()
 

Static Public Member Functions

static float FitText (Font font, String text, Rectangle rect, float maxFontSize, int runDirection)
 

Static Public Attributes

static PdfName SELF_SIGNED = PdfName.ADOBE_PPKLITE
 
static PdfName VERISIGN_SIGNED = PdfName.VERISIGN_PPKVS
 
static PdfName WINCER_SIGNED = PdfName.ADOBE_PPKMS
 
const int NOT_CERTIFIED = 0
 
const int CERTIFIED_NO_CHANGES_ALLOWED = 1
 
const int CERTIFIED_FORM_FILLING = 2
 
const int CERTIFIED_FORM_FILLING_AND_ANNOTATIONS = 3
 
const String questionMark
 

Properties

SignatureRender Render [get, set]
 
Image SignatureGraphic [get, set]
 
string Layer2Text [get, set]
 
string Layer4Text [get, set]
 
Rectangle Rect [get]
 
string Reason [get, set]
 
string Location [get, set]
 
ICipherParameters PrivKey [get]
 
X509Certificate[] CertChain [get]
 
object[] CrlList [get]
 
PdfName Filter [get]
 
int Page [get]
 
String FieldName [get]
 
Rectangle PageRect [get]
 
DateTime SignDate [get, set]
 
string TempFile [get]
 
Stream RangeStream [get]
 
PdfDictionary CryptoDictionary [get, set]
 
PdfStamper Stamper [get]
 
PdfSigGenericPKCS SigStandard [get]
 
string Contact [get, set]
 
Font Layer2Font [get, set]
 
bool Acro6Layers [get, set]
 
int RunDirection [get, set]
 
ISignatureEvent SignatureEvent [get, set]
 
Image Image [get, set]
 
float ImageScale [get, set]
 
int CertificationLevel [get, set]
 

Detailed Description

This class takes care of the cryptographic options and appearances that form a signature.

Member Enumeration Documentation

◆ SignatureRender

Enumeration representing the different rendering options of a signature

Enumerator
Description 
NameAndDescription 
GraphicAndDescription 

Member Function Documentation

◆ Close()

void iTextSharp.text.pdf.PdfSignatureAppearance.Close ( PdfDictionary  update)

This is the last method to be called when using external signatures. The general sequence is: PreClose(), GetDocumentBytes() and Close().

update is a PdfDictionary that must have exactly the same keys as the ones provided in preClose(Hashtable).

Parameters
updatea PdfDictionary with the key/value that will fill the holes defined in preClose(Hashtable)
Exceptions
DocumentExceptionon error
IOExceptionon error

◆ FitText()

static float iTextSharp.text.pdf.PdfSignatureAppearance.FitText ( Font  font,
String  text,
Rectangle  rect,
float  maxFontSize,
int  runDirection 
)
static

Fits the text to some rectangle adjusting the font size as needed.

Parameters
fontthe font to use
textthe text
rectthe rectangle where the text must fit
maxFontSizethe maximum font size
runDirectionthe run direction
Returns
the calculated font size that makes the text fit

◆ GetAppearance()

PdfTemplate iTextSharp.text.pdf.PdfSignatureAppearance.GetAppearance ( )

Gets the main appearance layer.

Consult PPKAppearances.pdf for further details.

Returns
the main appearance layer
Exceptions
DocumentExceptionon error
IOExceptionon error

◆ GetImage()

Image iTextSharp.text.pdf.PdfSignatureAppearance.GetImage ( )

Gets the background image for the layer 2.

Returns
the background image for the layer 2

◆ GetLayer()

PdfTemplate iTextSharp.text.pdf.PdfSignatureAppearance.GetLayer ( int  layer)

Gets a template layer to create a signature appearance. The layers can go from 0 to 4.

Consult PPKAppearances.pdf for further details.

Parameters
layerthe layer
Returns
a template

◆ GetNewSigName()

String iTextSharp.text.pdf.PdfSignatureAppearance.GetNewSigName ( )

Gets a new signature fied name that doesn't clash with any existing name.

Returns
a new signature fied name

◆ GetTopLayer()

PdfTemplate iTextSharp.text.pdf.PdfSignatureAppearance.GetTopLayer ( )

Gets the template that aggregates all appearance layers. This corresponds to the /FRM resource.

Consult PPKAppearances.pdf for further details.

Returns
the template that aggregates all appearance layers

◆ IsInvisible()

bool iTextSharp.text.pdf.PdfSignatureAppearance.IsInvisible ( )

Gets the visibility status of the signature.

Returns
the visibility status of the signature

◆ IsNewField()

bool iTextSharp.text.pdf.PdfSignatureAppearance.IsNewField ( )

Checks if a new field was created.

Returns
true if a new field was created, false if signing an existing field or if the signature is invisible

◆ IsPreClosed()

bool iTextSharp.text.pdf.PdfSignatureAppearance.IsPreClosed ( )

Checks if the document is in the process of closing.

Returns
true if the document is in the process of closing, false otherwise

◆ PreClose() [1/2]

void iTextSharp.text.pdf.PdfSignatureAppearance.PreClose ( )

This is the first method to be called when using external signatures. The general sequence is: PreClose(), GetDocumentBytes() and Close().

If calling PreClose() dont't call PdfStamper.Close().

No external signatures are allowed if this methos is called.

Exceptions
IOExceptionon error
DocumentExceptionon error

◆ PreClose() [2/2]

void iTextSharp.text.pdf.PdfSignatureAppearance.PreClose ( Hashtable  exclusionSizes)

This is the first method to be called when using external signatures. The general sequence is: PreClose(), GetDocumentBytes() and Close().

If calling PreClose() dont't call PdfStamper.Close().

If using an external signature exclusionSizes must contain at least the PdfName.CONTENTS key with the size that it will take in the document. Note that due to the hex string coding this size should be byte_size*2+2.

Parameters
exclusionSizesa Hashtable with names and sizes to be excluded in the signature calculation. The key is a PdfName and the value an Integer. At least the PdfName.CONTENTS must be present
Exceptions
IOExceptionon error
DocumentExceptionon error

◆ SetCrypto()

void iTextSharp.text.pdf.PdfSignatureAppearance.SetCrypto ( ICipherParameters  privKey,
X509Certificate[]  certChain,
object[]  crlList,
PdfName  filter 
)

Sets the cryptographic parameters.

Parameters
privKeythe private key
certChainthe certificate chain
crlListthe certificate revocation list. It may be null
filterthe crytographic filter type. It can be SELF_SIGNED, VERISIGN_SIGNED or WINCER_SIGNED

◆ SetExternalDigest()

void iTextSharp.text.pdf.PdfSignatureAppearance.SetExternalDigest ( byte[]  digest,
byte[]  RSAdata,
String  digestEncryptionAlgorithm 
)

Sets the digest/signature to an external calculated value.

Parameters
digestthe digest. This is the actual signature
RSAdatathe extra data that goes into the data tag in PKCS#7
digestEncryptionAlgorithmthe encryption algorithm. It may must be null if the digest is also null. If the digest is not null then it may be "RSA" or "DSA"

◆ SetVisibleSignature() [1/2]

void iTextSharp.text.pdf.PdfSignatureAppearance.SetVisibleSignature ( Rectangle  pageRect,
int  page,
String  fieldName 
)

Sets the signature to be visible. It creates a new visible signature field.

Parameters
pageRectthe position and dimension of the field in the page
pagethe page to place the field. The fist page is 1
fieldNamethe field name or null to generate automatically a new field name

◆ SetVisibleSignature() [2/2]

void iTextSharp.text.pdf.PdfSignatureAppearance.SetVisibleSignature ( String  fieldName)

Sets the signature to be visible. An empty signature field with the same name must already exist.

Parameters
fieldNamethe existing empty signature field name

Member Data Documentation

◆ CERTIFIED_FORM_FILLING

const int iTextSharp.text.pdf.PdfSignatureAppearance.CERTIFIED_FORM_FILLING = 2
static

◆ CERTIFIED_FORM_FILLING_AND_ANNOTATIONS

const int iTextSharp.text.pdf.PdfSignatureAppearance.CERTIFIED_FORM_FILLING_AND_ANNOTATIONS = 3
static

◆ CERTIFIED_NO_CHANGES_ALLOWED

const int iTextSharp.text.pdf.PdfSignatureAppearance.CERTIFIED_NO_CHANGES_ALLOWED = 1
static

◆ NOT_CERTIFIED

const int iTextSharp.text.pdf.PdfSignatureAppearance.NOT_CERTIFIED = 0
static

◆ questionMark

const String iTextSharp.text.pdf.PdfSignatureAppearance.questionMark
static

Commands to draw a yellow question mark in a stream content

◆ SELF_SIGNED

PdfName iTextSharp.text.pdf.PdfSignatureAppearance.SELF_SIGNED = PdfName.ADOBE_PPKLITE
static

The self signed filter.

◆ VERISIGN_SIGNED

PdfName iTextSharp.text.pdf.PdfSignatureAppearance.VERISIGN_SIGNED = PdfName.VERISIGN_PPKVS
static

The VeriSign filter.

◆ WINCER_SIGNED

PdfName iTextSharp.text.pdf.PdfSignatureAppearance.WINCER_SIGNED = PdfName.ADOBE_PPKMS
static

The Windows Certificate Security.

Property Documentation

◆ Acro6Layers

bool iTextSharp.text.pdf.PdfSignatureAppearance.Acro6Layers
getset

Acrobat 6.0 and higher recomends that only layer n2 and n4 be present. This method sets that mode.

Parameters
acro6Layersif true only the layers n2 and n4 will be present

◆ CertChain

X509Certificate [] iTextSharp.text.pdf.PdfSignatureAppearance.CertChain
get

Gets the certificate chain.

Returns
the certificate chain

◆ CertificationLevel

int iTextSharp.text.pdf.PdfSignatureAppearance.CertificationLevel
getset

Sets the document type to certified instead of simply signed.

Parameters
certificationLevelthe values can be: NOT_CERTIFIED, CERTIFIED_NO_CHANGES_ALLOWED, CERTIFIED_FORM_FILLING and CERTIFIED_FORM_FILLING_AND_ANNOTATIONS

◆ Contact

string iTextSharp.text.pdf.PdfSignatureAppearance.Contact
getset

Sets the signing contact.

Parameters
contactthe signing contact

◆ CrlList

object [] iTextSharp.text.pdf.PdfSignatureAppearance.CrlList
get

Gets the certificate revocation list.

Returns
the certificate revocation list

◆ CryptoDictionary

PdfDictionary iTextSharp.text.pdf.PdfSignatureAppearance.CryptoDictionary
getset

Gets the user made signature dictionary. This is the dictionary at the /V key.

Returns
the user made signature dictionary

◆ FieldName

String iTextSharp.text.pdf.PdfSignatureAppearance.FieldName
get

Gets the field name.

Returns
the field name

◆ Filter

PdfName iTextSharp.text.pdf.PdfSignatureAppearance.Filter
get

Gets the filter used to sign the document.

Returns
the filter used to sign the document

◆ Image

Image iTextSharp.text.pdf.PdfSignatureAppearance.Image
getset

Sets the background image for the layer 2.

Parameters
imagethe background image for the layer 2

◆ ImageScale

float iTextSharp.text.pdf.PdfSignatureAppearance.ImageScale
getset

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
imageScalethe scaling to be applied to the background image

◆ Layer2Font

Font iTextSharp.text.pdf.PdfSignatureAppearance.Layer2Font
getset

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

Parameters
layer2Fontthe n2 and n4 font

◆ Layer2Text

string iTextSharp.text.pdf.PdfSignatureAppearance.Layer2Text
getset

Sets the signature text identifying the signer.

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

◆ Layer4Text

string iTextSharp.text.pdf.PdfSignatureAppearance.Layer4Text
getset

Sets the text identifying the signature status.

Parameters
textthe text identifying the signature status. If null or not set the description "Signature Not Verified" will be used

◆ Location

string iTextSharp.text.pdf.PdfSignatureAppearance.Location
getset

Sets the signing location.

Parameters
locationthe signing location

◆ Page

int iTextSharp.text.pdf.PdfSignatureAppearance.Page
get

Gets the page number of the field.

Returns
the page number of the field

◆ PageRect

Rectangle iTextSharp.text.pdf.PdfSignatureAppearance.PageRect
get

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

Returns
the rectangle that represent the position and dimension of the signature in the page

◆ PrivKey

ICipherParameters iTextSharp.text.pdf.PdfSignatureAppearance.PrivKey
get

Gets the private key.

Returns
the private key

◆ RangeStream

Stream iTextSharp.text.pdf.PdfSignatureAppearance.RangeStream
get

Gets the document bytes that are hashable when using external signatures. The general sequence is: PreClose(), GetRangeStream() and Close().

Returns
the document bytes that are hashable

◆ Reason

string iTextSharp.text.pdf.PdfSignatureAppearance.Reason
getset

Sets the signing reason.

Parameters
reasonthe signing reason

◆ Rect

Rectangle iTextSharp.text.pdf.PdfSignatureAppearance.Rect
get

Gets the rectangle representing the signature dimensions.

Returns
the rectangle representing the signature dimensions. It may be null or have zero width or height for invisible signatures

◆ Render

SignatureRender iTextSharp.text.pdf.PdfSignatureAppearance.Render
getset

◆ RunDirection

int iTextSharp.text.pdf.PdfSignatureAppearance.RunDirection
getset

Sets the run direction in the n2 and n4 layer.

Parameters
runDirectionthe run direction

◆ SignatureEvent

ISignatureEvent iTextSharp.text.pdf.PdfSignatureAppearance.SignatureEvent
getset

Sets the signature event to allow modification of the signature dictionary.

Parameters
signatureEventthe signature event

◆ SignatureGraphic

Image iTextSharp.text.pdf.PdfSignatureAppearance.SignatureGraphic
getset

◆ SignDate

DateTime iTextSharp.text.pdf.PdfSignatureAppearance.SignDate
getset

Gets the signature date.

Returns
the signature date

◆ SigStandard

PdfSigGenericPKCS iTextSharp.text.pdf.PdfSignatureAppearance.SigStandard
get

Gets the instance of the standard signature dictionary. This instance is only available after pre close.

The main use is to insert external signatures.

Returns
the instance of the standard signature dictionary

◆ Stamper

PdfStamper iTextSharp.text.pdf.PdfSignatureAppearance.Stamper
get

Gets the PdfStamper associated with this instance.

Returns
the PdfStamper associated with this instance

◆ TempFile

string iTextSharp.text.pdf.PdfSignatureAppearance.TempFile
get

Gets the temporary file.

Returns
the temporary file or null is the document is created in memory

The documentation for this class was generated from the following file: