Foxit PDF SDK

Public Member Functions | Static Public Attributes | List of all members
FoxitPDFSDKPython2.Signature Class Reference
Inheritance diagram for FoxitPDFSDKPython2.Signature:

## Public Member Functions
def | Signature (document, sig_field_dict)
| Constructor, from signature field dictionary. More...
def | ClearSignedData ()
| Clear the data and appearance if current signature is singed and verified valid. More...
def | EnableEmbedFont (enable_embed_font)
| Enable or disable embed font. More...
def | EnableIncrementalSaveForFirstSigning (enable_incremental_save)
| Enable or disable incremental save for first signing. User should call this function before calling function FoxitPDFSDKPython2.Signature.StartSign . Default: false. More...
def | GenerateAppearance ()
| Generate the appearance of unsigned signature. More...
def | GetAppearanceFlags ()
| Get signature appearance flags. More...
def | GetBitmap ()
| Get a bitmap which is used for the signature appearance. More...
def | GetByteRangeArray (out_byte_range_array)
| Get the byte ranges data, including 4 elements. More...
def | GetCert (index)
| Get a certificate from current signature's certificate chain by index. More...
def | GetCertCount ()
| Get the count of certificates in current signature's certificate chain. More...
def | GetCertificateInfo (key)
| Get certificate information. More...
def | GetDocPermission ()
| Get document permission for current signature. More...
def | GetDocument ()
| Get the PDF document, which current signature belongs to. More...
def | GetFieldMDPAction ()
| Get FieldMDP("MDP" means modification detection and prevention) action type. More...
def | GetFieldMDPActionFields ()
| Get the field name array which is used for FieldMDP action. More...
def | GetFilter ()
| Get filter. More...
def | GetKeyLabel (label_name)
| Get the string for specified key label. More...
def | GetKeyValue (key)
| Get the string value for specified key name. More...
def | GetPAdESLevel ()
| Get PAdES level. More...
def | GetPagingSealGroupElements ()
| Get the group elements of current paging seal signature. More...
def | GetPagingSealSignature ()
| Get the paging seal signature. More...
def | GetSignatureDict ()
| Get signature dictionary. More...
def | GetSignatureType ()
| Get signature type. More...
def | GetSignedVersionDocument (file_path)
| Get the PDF document in the signed version in which current signature was signed. More...
def | GetSignTime ()
| Get time of signing. More...
def | GetState ()
| Get current state. More...
def | GetSubFilter ()
| Get sub filter. More...
def | IsEmpty ()
| Check whether current object is empty or not. More...
def | IsSigned ()
| Check whether current signature is signed or not. More...
def | IsTimeStamp ()
| Check if current signature is a time stamp signature. More...
def | SetAppearanceContent (appearance_content)
| Set customized appearance content (as low level drawing operation commands) for signed signature appearance. More...
def | SetAppearanceFlags (appearance_flags)
| Set signature appearance flags. More...
def | SetBitmap (bitmap)
| Set a bitmap for the signature appearance. More...
def | SetCertChain (cert_chain)
| Set a certificate chain. More...
def | SetCustomObject (key, pdf_object)
| Set custom PDF object for signature dictionary. More...
def | SetDefaultContentsLength (default_length)
| Set the default length of signature contents which represents signature value (known as signed data). More...
def | SetDocPermission (permission)
| Set document permission for current signature. More...
def | SetFieldMDPActionFields (action, field_array)
| Set FieldMDP("MDP" means modification detection and prevention) action names array. More...
def | SetFilter (filter)
| Set filter. More...
def | SetImage (file_path, frame_index)
| Set an image for the signature appearance, with a specified frame index. More...
def | SetImage (image, frame_index)
| Set an image for the signature appearance, with a specified frame index. More...
def | SetKeyLabel (label_name, label_value)
| Set the string for specified key label. More...
def | SetKeyValue (key, value)
| Set the string value for specified key name. More...
def | SetSignTime (sign_time)
| Set time of signing. More...
def | SetSubFilter (sub_filter)
| Set sub filter. More...
def | StartSign (cert_file_stream, cert_password, digest_algorithm, save_path, client_data, pause)
| Start signing current signature if current signature is unsigned. More...
def | StartSign (cert_file_stream, cert_password, digest_algorithm, stream_callback, client_data, pause)
| Start signing current signature if current signature is unsigned. More...
def | StartSign (cert_path, cert_password, digest_algorithm, stream_callback, client_data, pause)
| Start signing current signature if current signature is unsigned. More...
def | StartVerify (client_data, pause)
| Start verifying the intergrity of current signature if current signature is signed. More...
Public Member Functions inherited from FoxitPDFSDKPython2.Field
def | Field (field)
| Constructor, with another form field object. More...
def | GetAlignment ()
| Get the alignment value. More...
def | GetAlternateName ()
| Get alternate name. More...
def | GetControl (page, index)
| Get a form control by index, in a specified PDF page. More...
def | GetControlCount ()
| Get count of form controls. More...
def | GetControlCount (page)
| Get count of form controls in a specified PDF page. More...
def | GetDefaultAppearance ()
| Get the default appearance data. More...
def | GetDefaultValue ()
| Get default value. More...
def | GetDefaultValueObj ()
| Get the PDF object of field's default value. More...
def | GetDict ()
| Get the PDF dictionary of current object. More...
def | GetFlags ()
| Get field flags. More...
def | GetInheritedAttribute (attribute_name)
| Get the PDF object for specified attribute which may be inherited from the ancestor node in the field tree. More...
def | GetMappingName ()
| Get mapping name. More...
def | GetMaxLength ()
| Get maximum length of the field's text, in characters. More...
def | GetName ()
| Get field name. More...
def | GetOptions ()
| Get options of list box or combo box. More...
def | GetTopVisibleIndex ()
| Get top index of option for scrollable list boxes. More...
def | GetType ()
| Get field type. More...
def | GetValue ()
| Get value. More...
def | GetValueObj ()
| Get the PDF object of field's value. More...
def | Reset ()
| Reset data in current field to its default value. (Not support signature field) More...
def | SetAlignment (alignment)
| Set alignment property of a form, as a document-wide default value. (Not support signature field) More...
def | SetAlternateName (alternate_name)
| Set alternate name. (Not support signature field) More...
def | SetDefaultAppearance (default_ap)
| Set default appearance data. More...
def | SetDefaultValue (value)
| Set default value. More...
def | SetFlags (flags)
| Set field flags. More...
def | SetMappingName (name)
| Set mapping name. (Not support signature field) More...
def | SetMaxLength (max_length)
| Set maximum length of the field's text, in characters. More...
def | SetOptions (option_array)
| Set options of list box or combo box. More...
def | SetTopVisibleIndex (index)
| Set top index for scrollable list boxes. More...
def | SetValue (value)
| Set value. More...

## Static Public Attributes
| e_APFlagBitmap = _fsdk.Signature_e_APFlagBitmap
| If set, show bitmap on signature appearance.
| e_APFlagDN = _fsdk.Signature_e_APFlagDN
| If set, show distinguish name on signature appearance.
| e_APFlagFoxitEditorFlag = _fsdk.Signature_e_APFlagFoxitEditorFlag
| If set, show Foxit Editor content on signature appearance.
| e_APFlagFoxitFlag = _fsdk.Signature_e_APFlagFoxitFlag
| If set, show Foxit flag on signature appearance.
| e_APFlagLabel = _fsdk.Signature_e_APFlagLabel
| If set, show label on signature appearance.
| e_APFlagLocation = _fsdk.Signature_e_APFlagLocation
| If set, show location on signature appearance.
| e_APFlagProducer = _fsdk.Signature_e_APFlagProducer
| If set, show producer content on signature appearance.
| e_APFlagReason = _fsdk.Signature_e_APFlagReason
| If set, show reason on signature appearance.
| e_APFlagSigner = _fsdk.Signature_e_APFlagSigner
| If set, show signer on signature appearance.
| e_APFlagSigningTime = _fsdk.Signature_e_APFlagSigningTime
| If set, show signing time on signature appearance.
| e_APFlagText = _fsdk.Signature_e_APFlagText
| If set, show text content on signature appearance.
| e_DigestSHA1 = _fsdk.Signature_e_DigestSHA1
| Signature digest algorithm: sha1 algorithm.
| e_DigestSHA256 = _fsdk.Signature_e_DigestSHA256
| Signature digest algorithm: sha256 algorithm.
| e_DigestSHA384 = _fsdk.Signature_e_DigestSHA384
| Signature digest algorithm: sha384 algorithm.
| e_DigestSHA512 = _fsdk.Signature_e_DigestSHA512
| Signature digest algorithm: sha512 algorithm.
| e_DocPermFillingFormAndSigning = _fsdk.Signature_e_DocPermFillingFormAndSigning
| Permitted changes are filling in forms, instantiating page templates, and signing. Other changes will invalidate the signature.
| e_DocPermFillingFormSigningAndAnnotating = _fsdk.Signature_e_DocPermFillingFormSigningAndAnnotating
| Permitted changes are the same as for 2, as well as annotation creation, deletion, and modification. Other changes will invalidate the signature.
| e_DocPermNoChangesAllowed = _fsdk.Signature_e_DocPermNoChangesAllowed
| No changes to the PDF document (which is signed by the signture) are permitted. Any change to this kind of PDF document will invalidate the signature.
| e_DocPermUnrestricted = _fsdk.Signature_e_DocPermUnrestricted
| No restriction.
| e_FieldMDPActionAll = _fsdk.Signature_e_FieldMDPActionAll
| All form fields' flags will be set read-only.
| e_FieldMDPActionExclude = _fsdk.Signature_e_FieldMDPActionExclude
| Flags of form fields (except specified form fields) will be set read-only. More...
| e_FieldMDPActionInclude = _fsdk.Signature_e_FieldMDPActionInclude
| Specified form fields' flags will be set read-only. More...
| e_FieldMDPActionNone = _fsdk.Signature_e_FieldMDPActionNone
| No Field MDP action.
| e_KeyNameContactInfo = _fsdk.Signature_e_KeyNameContactInfo
| Signature key name: contact information.
| e_KeyNameDN = _fsdk.Signature_e_KeyNameDN
| Signature key name: distinguish name.
| e_KeyNameLocation = _fsdk.Signature_e_KeyNameLocation
| Signature key name: location.
| e_KeyNameProducer = _fsdk.Signature_e_KeyNameProducer
| Signature key name: producer content.
| e_KeyNameReason = _fsdk.Signature_e_KeyNameReason
| Signature key name: reason.
| e_KeyNameSigner = _fsdk.Signature_e_KeyNameSigner
| Signature key name: signer.
| e_KeyNameText = _fsdk.Signature_e_KeyNameText
| Signature key name: text content.
| e_LabelNameDN = _fsdk.Signature_e_LabelNameDN
| Signature key name for distinguish name. More...
| e_LabelNameLocation = _fsdk.Signature_e_LabelNameLocation
| Signature label name for location. More...
| e_LabelNameProducer = _fsdk.Signature_e_LabelNameProducer
| Signature key name for producer name. More...
| e_LabelNameReason = _fsdk.Signature_e_LabelNameReason
| Signature label name for reason. More...
| e_LabelNameSigner = _fsdk.Signature_e_LabelNameSigner
| Signature label name for signer. More...
| e_LabelNameSignTime = _fsdk.Signature_e_LabelNameSignTime
| Signature label name for sign time. More...
| e_PAdESLevelBB = _fsdk.Signature_e_PAdESLevelBB
| PAdES level: B-B.
| e_PAdESLevelBLT = _fsdk.Signature_e_PAdESLevelBLT
| PAdES level: B-LT.
| e_PAdESLevelBLTA = _fsdk.Signature_e_PAdESLevelBLTA
| PAdES level: B-LTA.
| e_PAdESLevelBT = _fsdk.Signature_e_PAdESLevelBT
| PAdES level: B-T.
| e_PAdESLevelNone = _fsdk.Signature_e_PAdESLevelNone
| PAdES level: none.
| e_PAdESLevelNotPAdES = _fsdk.Signature_e_PAdESLevelNotPAdES
| Not a PAdES signature.
| e_SignatureTypeOrdinary = _fsdk.Signature_e_SignatureTypeOrdinary
| Signature type: ordinary.
| e_SignatureTypePagingSeal = _fsdk.Signature_e_SignatureTypePagingSeal
| Signature type: paging seal.
| e_SignatureTypeTimeStamp = _fsdk.Signature_e_SignatureTypeTimeStamp
| Signature type: time stamp.
| e_StateCertCannotGetVRI = _fsdk.Signature_e_StateCertCannotGetVRI
| Cannot get verify relevant information.
| e_StateNoSignData = _fsdk.Signature_e_StateNoSignData
| Signature does not have any data for signing.It means that there is not "V" entry in the signature dictionary.
| e_StateSigned = _fsdk.Signature_e_StateSigned
| Signed signature.
| e_StateUnknown = _fsdk.Signature_e_StateUnknown
| Unknown signature.
| e_StateUnsigned = _fsdk.Signature_e_StateUnsigned
| Unsigned signature.
| e_StateVerifyChange = _fsdk.Signature_e_StateVerifyChange
| The document has been changed within the scope of the signature. (This indicates that signature is invalid.)
| e_StateVerifyChangeIllegal = _fsdk.Signature_e_StateVerifyChangeIllegal
| The document has been changed outside of signature scope, and the changed invalidate the signature.
| e_StateVerifyChangeLegal = _fsdk.Signature_e_StateVerifyChangeLegal
| The document has been changed outside of signature scope, but the changed is permitted.
| e_StateVerifyErrorByteRange = _fsdk.Signature_e_StateVerifyErrorByteRange
| Non expected byte range.
| e_StateVerifyErrorData = _fsdk.Signature_e_StateVerifyErrorData
| Signature data is destroyed (that means the signature data cannot be parsed properly).
| e_StateVerifyIncredible = _fsdk.Signature_e_StateVerifyIncredible
| Signature cannot be trusted (containing aggression).
| e_StateVerifyInvalid = _fsdk.Signature_e_StateVerifyInvalid
| Verification state of a signature is invalid.
| e_StateVerifyIssueCurrent = _fsdk.Signature_e_StateVerifyIssueCurrent
| The verified issue is current issuer.
| e_StateVerifyIssueExpire = _fsdk.Signature_e_StateVerifyIssueExpire
| Certificate for verifying issuer is expired.
| e_StateVerifyIssueRevoke = _fsdk.Signature_e_StateVerifyIssueRevoke
| Certificate for verifying issuer is revoked.
| e_StateVerifyIssueUncheck = _fsdk.Signature_e_StateVerifyIssueUncheck
| Not check the issuer.
| e_StateVerifyIssueUnknown = _fsdk.Signature_e_StateVerifyIssueUnknown
| Verification state of the issuer is unknown.
| e_StateVerifyIssueValid = _fsdk.Signature_e_StateVerifyIssueValid
| Verification state of the issuer is valid.
| e_StateVerifyNoChange = _fsdk.Signature_e_StateVerifyNoChange
| The document has not been changed within the scope of the signature.
| e_StateVerifyNoSupportWay = _fsdk.Signature_e_StateVerifyNoSupportWay
| Unsupported signature.
| e_StateVerifyTimestampDoc = _fsdk.Signature_e_StateVerifyTimestampDoc
| The signature is a time stamp signature.
| e_StateVerifyTimestampExpire = _fsdk.Signature_e_StateVerifyTimestampExpire
| Verification state of the time stamp is expired.
| e_StateVerifyTimestampInvalid = _fsdk.Signature_e_StateVerifyTimestampInvalid
| Verification state of the time stamp is invalid.
| e_StateVerifyTimestampIssueUnknown = _fsdk.Signature_e_StateVerifyTimestampIssueUnknown
| Verification state of the time stamp issuer is unknown.
| e_StateVerifyTimestampIssueValid = _fsdk.Signature_e_StateVerifyTimestampIssueValid
| Verification state of the time stamp issuer is valid.
| e_StateVerifyTimestampNone = _fsdk.Signature_e_StateVerifyTimestampNone
| No time stamp or not check time stamp.
| e_StateVerifyTimestampTimeBefore = _fsdk.Signature_e_StateVerifyTimestampTimeBefore
| Verification state of the time stamp time is valid, since the times is before the expiration date.
| e_StateVerifyTimestampValid = _fsdk.Signature_e_StateVerifyTimestampValid
| Verification state of the time stamp is valid.
| e_StateVerifyValid = _fsdk.Signature_e_StateVerifyValid
| Verification state of a signature is valid.
Static Public Attributes inherited from FoxitPDFSDKPython2.Field
| e_FlagButtonNoToggleToOff = _fsdk.Field_e_FlagButtonNoToggleToOff
| (Only useful for radio button) If set, exactly one radio button must be selected at all times; clicking the currently selected button has no effect. If clear, clicking the selected button deselects it, leaving no button selected.
| e_FlagButtonRadiosInUnison = _fsdk.Field_e_FlagButtonRadiosInUnison
| (Only useful for radio button) If set, a group of radio buttons within a radio button field that use the same value for the on state will turn on and off in unison; that is if one is checked, they are all checked. If clear, the buttons are mutually exclusive.
| e_FlagChoiceCommitOnSelChange = _fsdk.Field_e_FlagChoiceCommitOnSelChange
| (Only useful for choice field) If set, the new value is committed as soon as a selection is made with the pointing device; if clear, the new value is not committed until the user exits the field.
| e_FlagChoiceMultiSelect = _fsdk.Field_e_FlagChoiceMultiSelect
| (Only useful for list box) If set, more than one items may be selected simultaneously; if clear, no more than one item at a time may be selected.
| e_FlagChoiceSort = _fsdk.Field_e_FlagChoiceSort
| (Only useful for choice field) If set, the field's option items should be sorted alphabetically.
| e_FlagComboEdit = _fsdk.Field_e_FlagComboEdit
| (Only useful for combo box) If set, the combo box includes an editable text control with a drop-down list, if clear, it includes only a drop-down list.
| e_FlagNoExport = _fsdk.Field_e_FlagNoExport
| if set, the field must not be exported by a submit-form action.
| e_FlagReadOnly = _fsdk.Field_e_FlagReadOnly
| If set, the user may not change the value of the field. Any associated widget annotations will not interact with the user; that is, they will not respond to mouse clicks or change their appearance in response to mouse motions. This flag is useful for fields whose values are computed or imported from a database.
| e_FlagRequired = _fsdk.Field_e_FlagRequired
| If set, the field must have a value at the time it is exported by a submit-form action.
| e_FlagTextComb = _fsdk.Field_e_FlagTextComb
| (Only useful for text field) If set, use combs. More...
| e_FlagTextDoNotScroll = _fsdk.Field_e_FlagTextDoNotScroll
| (Only useful for text field) If set, the field does not scroll (horizontally for single-line fields, vertically for multiple-line fields) to accommodate more text than fits within its annotation rectangle. Once the field is full, no further text is accepted.
| e_FlagTextFileSelect = _fsdk.Field_e_FlagTextFileSelect
| (Only useful for text field) If set, the text entered in the field represents the pathname of a file whose contents are to be submitted as the value of the field.
| e_FlagTextMultiline = _fsdk.Field_e_FlagTextMultiline
| (Only useful for text field) If set, the text field can contain multiple lines of text; if clear, the field's text is restricted to a single line.
| e_FlagTextNoSpellCheck = _fsdk.Field_e_FlagTextNoSpellCheck
| (Only useful for text field) If set, text entered in the field is not spell-checked.
| e_FlagTextPassword = _fsdk.Field_e_FlagTextPassword
| (Only useful for text field) If set, the field is intended for entering a secure password that should not be echoed visibly to the screen. Characters typed from the keyboard should instead be echoed in some unreadable form, such as asterisks or bullet characters. More...
| e_FlagTextRichText = _fsdk.Field_e_FlagTextRichText
| (Only useful for text field) If set, the value of this field should be represented as a rich text string.
| e_TypeCheckBox = _fsdk.Field_e_TypeCheckBox
| Form field type: check box.
| e_TypeComboBox = _fsdk.Field_e_TypeComboBox
| Form field type: combo box.
| e_TypeListBox = _fsdk.Field_e_TypeListBox
| Form field type: list box.
| e_TypePushButton = _fsdk.Field_e_TypePushButton
| Form field type: push button.
| e_TypeRadioButton = _fsdk.Field_e_TypeRadioButton
| Form field type: radio button.
| e_TypeSignature = _fsdk.Field_e_TypeSignature
| Form field type: signature field.
| e_TypeTextField = _fsdk.Field_e_TypeTextField
| Form field type: text field.
| e_TypeUnknown = _fsdk.Field_e_TypeUnknown
| Form field type: unknown.

## Detailed Description

A digital signature (PDF 1.3) can be used to authenticate the identity of a user and the document's contents. It stores information about the signer and the state of the document when it was signed. The signature is contained in a signature field, as a type of form field, so class Signature is derived from class FoxitPDFSDKPython2.Field . A signature object can be retrieved/added by following functions:

- To be counted and retrieved as a signature object directly from PDF document, please use functions FoxitPDFSDKPython2.PDFDoc.GetSignatureCount and FoxitPDFSDKPython2.PDFDoc.GetSignature .
- To be counted and retrieved as a signature field, please use functions FoxitPDFSDKPython2.Form.GetFieldCount and FoxitPDFSDKPython2.Form.GetField when field type is FoxitPDFSDKPython2.Field.e_TypeSignature .
- To add a new signature, please use function FoxitPDFSDKPython2.PDFPage.AddSignature .
- To remove a signature, please use function FoxitPDFSDKPython2.PDFDoc.RemoveSignature .

In a signature, filter and sub filter keys are used to specify the filter and sub filter of signature callback object which will be used to sign and verify the signature. Foxit PDF SDK has default signature callbacks for following filter and sub filter:

- filter: "Adobe.PPKLite" and sub filter: "adbe.pkcs7.detached"
- filter: "Adobe.PPKLite" and sub filter: "adbe.pkcs7.sha1"
- filter: "Adobe.PPKLite" and sub filter: "ETSI.CAdES.detached"
- filter: "Adobe.PPKLite" and sub filter: "ETSI.RFC3161"

For sub filter "ETSI.CAdES.detached" and sub filter "ETSI.RFC3161", please ensure a default time stmap server has been set to TimeStampServerMgr if default signature callbacks for them will be used to do signing. For other filter and sub filter or if user wants to use customized signature callback for above filter and sub filter, user should prepare customized signature callback and register the callback to Foxit PDF SDK by function FoxitPDFSDKPython2.Library.RegisterSignatureCallback .
This class offers functions to get/set signature information/properties, sign or verify a signature, and so on. For example:

- To sign an unsigned signature, please use functions FoxitPDFSDKPython2.Signature.StartSign . When signing a signature successfully, user is strongly recommended to close current document and then open the signed PDF document and then do following operation.
- To verify the integrity of a signed signature, please use functions FoxitPDFSDKPython2.Signature.StartVerify . To check if a signed signature is valid or not, please refer to class LTVVerifier .
- To retrieve signature dictionary directly, please use function FoxitPDFSDKPython2.Signature.GetSignatureDict .

Before signing an unsigned signature, user can call following functions to set information for signing and signed appearance:

- For using default Foxit appearance template, related information can be set by FoxitPDFSDKPython2.Signature.SetAppearanceFlags , FoxitPDFSDKPython2.Signature.SetSignTime , FoxitPDFSDKPython2.Signature.SetKeyValue , FoxitPDFSDKPython2.Signature.SetBitmap , FoxitPDFSDKPython2.Signature.SetImage .
- For using customized appearance, please set appearance stream content by function FoxitPDFSDKPython2.Signature.SetAppearanceContent .

If an unsigned signature has been set some information for signing, but the document is saved directly or closed without signing the signature, these data (including filter and sub filter) will be lost in the saved document or in the closed document. When the document is opened again, the unsigned signature needs to be specified at least filter and sub filter for signing; otherwise, this signature cannot be signed.

See also
  FoxitPDFSDKPython2.Field
  FoxitPDFSDKPython2.Form
  PDFDoc
  PDFPage
  TimeStampServerMgr
  LTVVerifier

## Constructor & Destructor Documentation

## ◆ Signature()

def FoxitPDFSDKPython2.Signature.Signature | ( |  | document,
|  |  | sig_field_dict
| ) |  |

Constructor, from signature field dictionary.

Parameters

  [in] | document | A valid PDF document.
  [in] | sig_field_dict | A PDF dictionary which represents a signature field. It should belong to the PDF document specified by parameter document;

## Member Function Documentation

## ◆ ClearSignedData()

def FoxitPDFSDKPython2.Signature.ClearSignedData | ( |  | ) |

Clear the data and appearance if current signature is singed and verified valid.

This function is used for a signed and valid signature.
Attention: From 7.0, this function is only used to verify the intergrity of a signature. To check if a signature is valid or not, please refer to class LTVVerifier .

Returns
  true means clear the data and appearance successfully, while false means no need to clear data and appearance or any error.

## ◆ EnableEmbedFont()

def FoxitPDFSDKPython2.Signature.EnableEmbedFont | ( |  | enable_embed_font | ) |

Enable or disable embed font.

Parameters

  A | flag indicates that whether to embed font for siganture's text. true means that embed font for siganture's text. false means that not to embed font for siganture's text.

Returns
  None.

## ◆ EnableIncrementalSaveForFirstSigning()

def FoxitPDFSDKPython2.Signature.EnableIncrementalSaveForFirstSigning | ( |  | enable_incremental_save | ) |

Enable or disable incremental save for first signing. User should call this function before calling function FoxitPDFSDKPython2.Signature.StartSign .
Default: false.

Parameters

  [in] | enable_incremental_save | A flag indicates that whether to use incremental save for first signing. true means that use incremental save for first signing. false means that use default save for first signing.

Returns
  None.

## ◆ GenerateAppearance()

def FoxitPDFSDKPython2.Signature.GenerateAppearance | ( |  | ) |

Generate the appearance of unsigned signature.

This function is used to display the unsigned ordinary signature on page without calling the function FoxitPDFSDKPython2.Signature.StartSign .

Returns
  true means success, while false means failure.

Reimplemented in FoxitPDFSDKPython2.PagingSealSignature.

## ◆ GetAppearanceFlags()

def FoxitPDFSDKPython2.Signature.GetAppearanceFlags | ( |  | ) |

Get signature appearance flags.

Signature appearance flags indicate which information will be shown. Currently, this is only useful after FoxitPDFSDKPython2.Signature.SetAppearanceFlags is set successfully. For a signature gotten from PDF document, the return value of this function would be useless.

Returns
  Signature appearance flags. Please refer to values starting from FoxitPDFSDKPython2.Signature.e_APFlagFoxitFlag and this would be one or a combination of these values.

## ◆ GetBitmap()

def FoxitPDFSDKPython2.Signature.GetBitmap | ( |  | ) |

Get a bitmap which is used for the signature appearance.

Returns
  The bitmap used in appearance. If the return value of function FoxitPDFSDKPython2.Bitmap.IsEmpty for the returned bitmap object is true, that means no bitmap is used in appearance or there is any error.

## ◆ GetByteRangeArray()

def FoxitPDFSDKPython2.Signature.GetByteRangeArray | ( |  | out_byte_range_array | ) |

Get the byte ranges data, including 4 elements.

This function is used for a signed signature to retrieve its byte range for digest calculation. The array of byte ranges contains 4 elements. These 4 elements are always in pairs of integers (starting byte offset, length in bytes), describing the exact byte range for the digest calculation.
Please refer to <PDF Reference 1.7> Section 8.7 Digital Signatures for more details.

Parameters

  [out] | out_byte_range_array | Output parameter that receives data of byte ranges. Please ensure this array can contain 4 elements.

Returns
  true means success, while false means failure.

## ◆ GetCert()

def FoxitPDFSDKPython2.Signature.GetCert | ( |  | index | ) |

Get a certificate from current signature's certificate chain by index.

This function is recommended to be used before verifying a signature. When sub filter of current signature is "adbe.x509.rsa_sha1", application needs to call this function to get verified public certificate before verifying signature. The first certificate in certificate chain is the signing certificate, and it can be used to verify the signature.

Parameters

  [in] | index | The index of certificate to be gotten. Valid range: from 0 to (count-1). count is returned by function FoxitPDFSDKPython2.Signature.GetCertCount .

Returns
  A certificate.

## ◆ GetCertCount()

def FoxitPDFSDKPython2.Signature.GetCertCount | ( |  | ) |

Get the count of certificates in current signature's certificate chain.

This function is recommended to be used before verifying a signature. When sub filter of current signature is "adbe.x509.rsa_sha1", application needs to call this function to get the count of certificates in certificate chain and then call function FoxitPDFSDKPython2.Signature.GetCert to get verified public certificate before verifying signature.

Returns
  The count of certificates.

## ◆ GetCertificateInfo()

def FoxitPDFSDKPython2.Signature.GetCertificateInfo | ( |  | key | ) |

Get certificate information.

This function is used for a signed signature. Currently, this function only supports for iOS and android platform.

Parameters

  [in] | key | Certificate key string. Currently it can be one of the following keys: "SerialNumber" "Issuer" "Subject" "ValidPeriodFrom" "ValidPeriodTo"

Returns
  Certificate information string.

Note
  For "ValidPeriodFrom" or "ValidPeriodTo" key, timezone value will not be computed in.

## ◆ GetDocPermission()

def FoxitPDFSDKPython2.Signature.GetDocPermission | ( |  | ) |

Get document permission for current signature.

- If permission value is not FoxitPDFSDKPython2.Signature.e_DocPermUnrestricted , that means adding new signature will fail when current signature is signed
- If permission value is FoxitPDFSDKPython2.Signature.e_DocPermFillingFormAndSigning or FoxitPDFSDKPython2.Signature.e_DocPermFillingFormSigningAndAnnotating , that means current signature field's flag is read-only when current signature is signed.

Returns
  The document permission.Please refer to values starting from FoxitPDFSDKPython2.Signature.e_DocPermUnrestricted and this should be one of these values.

## ◆ GetDocument()

def FoxitPDFSDKPython2.Signature.GetDocument | ( |  | ) |

Get the PDF document, which current signature belongs to.

Returns
  A PDF document object.

## ◆ GetFieldMDPAction()

def FoxitPDFSDKPython2.Signature.GetFieldMDPAction | ( |  | ) |

Get FieldMDP("MDP" means modification detection and prevention) action type.

Returns
  FieldMDP action type. Please refer to values starting from FoxitPDFSDKPython2.Signature.e_FieldMDPActionNone and this should be one of these values.

## ◆ GetFieldMDPActionFields()

def FoxitPDFSDKPython2.Signature.GetFieldMDPActionFields | ( |  | ) |

Get the field name array which is used for FieldMDP action.

Returned field name array is associated to the FieldMDP action (which can be checked by function FoxitPDFSDKPython2.Signature.GetFieldMDPAction ):

- If FieldMDP action type is FoxitPDFSDKPython2.Signature.e_FieldMDPActionNone , returned field name array is uselss.
- If FieldMDP action type is FoxitPDFSDKPython2.Signature.e_FieldMDPActionAll , returned field name array will contain name of all form fields.
- If FieldMDP action type is FoxitPDFSDKPython2.Signature.e_FieldMDPActionInclude , returned field name array specifies form fields whose flags are read-only when current signature is signed.
- If FieldMDP action type is FoxitPDFSDKPython2.Signature.e_FieldMDPActionExclude , returned field name array specifies form fields whose flags are not read-only (but rest fields' flags are read-only) when current signature is a signed signature.

Returns
  FieldMDP action field name array.

## ◆ GetFilter()

def FoxitPDFSDKPython2.Signature.GetFilter | ( |  | ) |

Get filter.

Filter and sub filter are used to specify which registered signature callback object will be used to sign/verify current signature.

Returns
  Filter string.

## ◆ GetKeyLabel()

def FoxitPDFSDKPython2.Signature.GetKeyLabel | ( |  | label_name | ) |

Get the string for specified key label.

If current signature is a time stamp signature, this function will always return an empty string.

Parameters

  [in] | label_name | Key label. Please refer to values starting from FoxitPDFSDKPython2.Signature.e_LabelNameSigner and this should be one of these values.

Returns
  String for specified key label.

## ◆ GetKeyValue()

def FoxitPDFSDKPython2.Signature.GetKeyValue | ( |  | key | ) |

Get the string value for specified key name.

This function is used to get string value of some key in signature dictionary, such as "Reason", "Location" and so on. Specially,

Parameters

  [in] | key | Key name. Please refer to values starting from FoxitPDFSDKPython2.Signature.e_KeyNameSigner and this should be one of these values.

Returns
  The string value.

## ◆ GetPAdESLevel()

def FoxitPDFSDKPython2.Signature.GetPAdESLevel | ( |  | ) |

Get PAdES level.

Returns
  PAdES level. Please refer to values starting from FoxitPDFSDKPython2.Signature.e_PAdESLevelNotPAdES and this would be one of these values.

## ◆ GetPagingSealGroupElements()

def FoxitPDFSDKPython2.Signature.GetPagingSealGroupElements | ( |  | ) |

Get the group elements of current paging seal signature.

If current signature type is FoxitPDFSDKPython2.Signature.e_SignatureTypePagingSeal , this function will return the array of signature associated with current signature. Otherwise, an empty array will be returned.

Returns
  A signature array.

## ◆ GetPagingSealSignature()

def FoxitPDFSDKPython2.Signature.GetPagingSealSignature | ( |  | ) |

Get the paging seal signature.

If current signature type is FoxitPDFSDKPython2.Signature.e_SignatureTypePagingSeal , this function will return the paging seal signature object associated with current signature.

Returns
  A PagingSealSignature object. If the return value of function FoxitPDFSDKPython2.Signature.IsEmpty for the returned object is true, that means current signature is not paging seal signature.

## ◆ GetSignatureDict()

def FoxitPDFSDKPython2.Signature.GetSignatureDict | ( |  | ) |

Get signature dictionary.

Signature dictionary is a part of signature field dictionary.

Returns
  The signature dictionary. If there is any error, this function will return null.

## ◆ GetSignatureType()

def FoxitPDFSDKPython2.Signature.GetSignatureType | ( |  | ) |

Get signature type.

Returns
  Signature type. Please refer to values starting from FoxitPDFSDKPython2.Signature.e_SignatureTypeOrdinary and this would be one of these values.

## ◆ GetSignedVersionDocument()

def FoxitPDFSDKPython2.Signature.GetSignedVersionDocument | ( |  | file_path | ) |

Get the PDF document in the signed version in which current signature was signed.

This function is useful when a PDF document has benn signed by serveral signatures and user wants to get the PDF document in which one signature is signed.

Parameters

  [in] | file_path | The full path of the original opened PDF document which current signature belongs to. It should not be an empty string.

Returns
  A PDF document object in singed version in which current signature was signed. The returned PDF document may represent a differenct PDF document from current PDF document where current signature is retrieved, or is just current PDF document. User should ensure to keep current PDF document object valid when reading or operating signed version document. Please ensure the returned document object has been loaded successfully, before using most functions in class PDFDoc .

## ◆ GetSignTime()

def FoxitPDFSDKPython2.Signature.GetSignTime | ( |  | ) |

Get time of signing.

Returns
  A date and time object that receives the signing time. If no signing time is found, this function will return a date and time object with all values 0.

## ◆ GetState()

def FoxitPDFSDKPython2.Signature.GetState | ( |  | ) |

Get current state.

- Before verifying a signature, this function is to get the state about if current signature is signed or if current signature is lack of data for signing.
- After verifying a signature, this function is to get the verified state – which indicates that the verified signature is signed; if the verified signature is still unsigned, this function will get the unsigned state instead.

Returns
  The value of signature state. Please refer to values starting from FoxitPDFSDKPython2.Signature.e_StateUnknown and this would be one or combination of them.
  Specially, if the returned state is FoxitPDFSDKPython2.Signature.e_StateNoSignData , that means current signature has no data for signing, and please at least call function FoxitPDFSDKPython2.Signature.SetKeyValue to set necessary filter and sub filter to current signature. Use can also call following functions to set other data for signing and signed appearance before calling function FoxitPDFSDKPython2.Signature.StartSign :
  - For using default Foxit appearance template, related information can be set by FoxitPDFSDKPython2.Signature.SetAppearanceFlags , FoxitPDFSDKPython2.Signature.SetSignTime , FoxitPDFSDKPython2.Signature.SetKeyValue , FoxitPDFSDKPython2.Signature.SetBitmap , FoxitPDFSDKPython2.Signature.SetImage .
  - For using customized appearance, please set appearance stream content by function FoxitPDFSDKPython2.Signature.SetAppearanceContent .

## ◆ GetSubFilter()

def FoxitPDFSDKPython2.Signature.GetSubFilter | ( |  | ) |

Get sub filter.

Filter and sub filter are used to specify which registered signature callback object will be used to sign/verify current signature.

Returns
  Sub filter string.

## ◆ IsEmpty()

def FoxitPDFSDKPython2.Signature.IsEmpty | ( |  | ) |

Check whether current object is empty or not.

When the current object is empty, that means current object is useless.

Returns
  true means current object is empty, while false means not.

Reimplemented from FoxitPDFSDKPython2.Field.

## ◆ IsSigned()

def FoxitPDFSDKPython2.Signature.IsSigned | ( |  | ) |

Check whether current signature is signed or not.

Returns
  true means current signature is signed, and false means not.

## ◆ IsTimeStamp()

def FoxitPDFSDKPython2.Signature.IsTimeStamp | ( |  | ) |

Check if current signature is a time stamp signature.

Returns
  true means current signature is a time stamp signature, while false means not.

## ◆ SetAppearanceContent()

def FoxitPDFSDKPython2.Signature.SetAppearanceContent | ( |  | appearance_content | ) |

Set customized appearance content (as low level drawing operation commands) for signed signature appearance.

This function can only be used for an unsigned signature before calling function FoxitPDFSDKPython2.Signature.StartSign for the unsigned signature.
Once customized appearance content is set, it will be used as the signed appearance. In this case, appearance flags set by FoxitPDFSDKPython2.Signature.SetAppearanceFlags will be ignored and related informations will not be used in appearance – these information are set by: FoxitPDFSDKPython2.Signature.SetSignTime , FoxitPDFSDKPython2.Signature.SetKeyValue (except filter and sub-filter), FoxitPDFSDKPython2.Signature.SetBitmap , FoxitPDFSDKPython2.Signature.SetImage .
If current signature is a time stamp signature, this function will do nothing.

Parameters

  [in] | appearance_content | Customized appearance content. This should be sequence of drawing operation commands to be used for the appearance, for example "10 10 m 20 10 l S". Please refer to <PDF Reference 1.7> P196 for more details.

Returns
  None.

## ◆ SetAppearanceFlags()

def FoxitPDFSDKPython2.Signature.SetAppearanceFlags | ( |  | appearance_flags | ) |

Set signature appearance flags.

This function is recommended to be used before calling function FoxitPDFSDKPython2.Signature.StartSign for an unsigned signature.
Signature appearance flags indicate which information will be shown in the signed appearance. If customized appearance content has been set by function FoxitPDFSDKPython2.Signature.SetAppearanceContent , appearance flags will be ignored.
If current signature is a time stamp signature, this function will do nothing.

Parameters

  [in] | appearance_flags | Signature appearance flags. Please refer to values starting from FoxitPDFSDKPython2.Signature.e_APFlagFoxitFlag and this should be one or a combination of these values.

Returns
  None.

## ◆ SetBitmap()

def FoxitPDFSDKPython2.Signature.SetBitmap | ( |  | bitmap | ) |

Set a bitmap for the signature appearance.

This function is recommended to be used before calling function FoxitPDFSDKPython2.Signature.StartSign for an unsigned signature. If customized appearance content has been set by function FoxitPDFSDKPython2.Signature.SetAppearanceContent , the bitmap will not be used in signed appearance.
If current signature is a time stamp signature, this function will do nothing.

Parameters

  [in] | bitmap | A bitmap to be set to the appearance. It should be valid.

Returns
  None.

## ◆ SetCertChain()

def FoxitPDFSDKPython2.Signature.SetCertChain | ( |  | cert_chain | ) |

Set a certificate chain.

This function is recommended to be used before signing an unsigned signature. When the signature sub filter is "adbe.x509.rsa_sha1", users need to call this function to set the cert chain to the signature. For other sub filter, this function will return directly without doing anything.

Parameters

  [in] | cert_chain | A string array that represents the certificate chain.

Returns
  None.

## ◆ SetCustomObject()

def FoxitPDFSDKPython2.Signature.SetCustomObject | ( |  | key,
|  |  | pdf_object
| ) |  |

Set custom PDF object for signature dictionary.

This function is recommended to be used before calling function FoxitPDFSDKPython2.Signature.StartSign for an unsigned signature.

Parameters

  [in] | key | The key of signature dictionary, whose value element will be set. It should not be an empty string.
  [in] | pdf_object | A custom PDFObject object to be set as the key's value. It should not be null. It can be a direct PDF object or an indirect PDF object.

Returns
  None.

## ◆ SetDefaultContentsLength()

def FoxitPDFSDKPython2.Signature.SetDefaultContentsLength | ( |  | default_length | ) |

Set the default length of signature contents which represents signature value (known as signed data).

This function can only be used before function FoxitPDFSDKPython2.Signature.StartSign for an unsigned signature.
Signature contents represent the signature value (known as signed data). When initializing the signature field, the signature contents will be initialized with the default length 7942. When using custom signature callback to sign and verify an unsigned signature, user can call this function to change the default length of signature contents. In this case, user should also ensure that the length of returned signed data in callback function FoxitPDFSDKPython2.SignatureCallback.Sign should not be larger than the default length set by this function.

Parameters

  [in] | default_length | The default length of the signature value (known as signed data), in bytes. It should not be less than 4098.

Returns
  None.

## ◆ SetDocPermission()

def FoxitPDFSDKPython2.Signature.SetDocPermission | ( |  | permission | ) |

Set document permission for current signature.

This function is only useful for an unsigned signature. If this function is used for a signed signature, nothing will be done.
Some notes about the permission value:

- If any permission value except FoxitPDFSDKPython2.Signature.e_DocPermUnrestricted is set to current unsigned signature, then adding new signature will fail when current signature is a signed signature.
- If permission value FoxitPDFSDKPython2.Signature.e_DocPermFillingFormAndSigning or FoxitPDFSDKPython2.Signature.e_DocPermFillingFormSigningAndAnnotating is set to current unsigned signature, then FieldMDP action would be FoxitPDFSDKPython2.Signature.e_FieldMDPActionInclude and current signature field's flag would be read-only when current signature is a signed signature.

Parameters

  [in] | permission | The document permission. Please refer to values starting from FoxitPDFSDKPython2.Signature.e_DocPermUnrestricted and this should be one of these values.

Returns
  None.

## ◆ SetFieldMDPActionFields()

def FoxitPDFSDKPython2.Signature.SetFieldMDPActionFields | ( |  | action,
|  |  | field_array
| ) |  |

Set FieldMDP("MDP" means modification detection and prevention) action names array.

This function is only useful for an unsigned signature. If this function is used for a signed signature, nothing will be done.
If current signature is signed, this function is invalidate.

Parameters

  [in] | action | FieldMDP action type.Please refer to values starting from FoxitPDFSDKPython2.Signature.e_FieldMDPActionNone and this should be one of these values. If this value is FoxitPDFSDKPython2.Signature.e_FieldMDPActionNone , that means no FieldMDP action will be used. If this value is FoxitPDFSDKPython2.Signature.e_FieldMDPActionAll , parameter field_array will be ignored and all fields will be included in the object digest (and hence do not permit changes after current signature is signed). If this value is FoxitPDFSDKPython2.Signature.e_FieldMDPActionInclude , that means only flags of form fields specified by parameter field_array will be set read-only and these fields will be included in the object digest (and hence do not permit changes after current signature is signed). If this value is FoxitPDFSDKPython2.Signature.e_FieldMDPActionExclude , that means flags of form fields (except those specified by parameter field_array) will be set read-only and these fields are included in the object digest (and hence do not permit changes after current signature is signed).
  [in] | field_array | A field name array used for FieldMDP action.

Returns
  None.

## ◆ SetFilter()

def FoxitPDFSDKPython2.Signature.SetFilter | ( |  | filter | ) |

Set filter.

Filter and sub filter are used to specify which registered signature callback object will be used to sign/verify current signature. User could should set filter and sub filter to use default signature callback in Foxit PDF SDK, or use other filter and sub fitler but please ensure that a signature callback object with non-default filter and sub filter should has been registered in Foxit PDF SDK before signing or verifying current signature. Filter and sub filter for default signature callback are:

- filter: "Adobe.PPKLite" and sub filter: "adbe.pkcs7.detached"
- filter: "Adobe.PPKLite" and sub filter: "adbe.pkcs7.sha1"
- filter: "Adobe.PPKLite" and sub filter: "ETSI.CAdES.detached"
- filter: "Adobe.PPKLite" and sub filter: "ETSI.RFC3161"

Parameters

  [in] | filter | String for filter. It cannot be an empty string.

Returns
  None.

## ◆ SetImage() [1/2]

def FoxitPDFSDKPython2.Signature.SetImage | ( |  | file_path,
|  |  | frame_index
| ) |  |

Set an image for the signature appearance, with a specified frame index.

This function is recommended to be used before calling function FoxitPDFSDKPython2.Signature.StartSign for an unsigned signature. If customized appearance content has been set by function FoxitPDFSDKPython2.Signature.SetAppearanceContent , the image will not be used in signed appearance.
Input image may contain multiple frames, and only one frame of the image can be set to current signature.
If current signature is a time stamp signature, this function will do nothing.

Parameters

  [in] | file_path | A full path of an existing image file. It should not be an empty string.
  [in] | frame_index | Frame index. Valid range: from 0 to (count-1). count is returned by function FoxitPDFSDKPython2.Image.GetFrameCount of input image file.

Returns
  None.

## ◆ SetImage() [2/2]

def FoxitPDFSDKPython2.Signature.SetImage | ( |  | image,
|  |  | frame_index
| ) |  |

Set an image for the signature appearance, with a specified frame index.

This function is recommended to be used before calling function FoxitPDFSDKPython2.Signature.StartSign for an unsigned signature. If customized appearance content has been set by function FoxitPDFSDKPython2.Signature.SetAppearanceContent , the image will not be used in signed appearance.
Input image may contain multiple frames, and only one frame of the image can be set to current signature.
If current signature is a time stamp signature, this function will do nothing.

Parameters

  [in] | image | An image. One of its frames will be set to current signature. This image contains at least one frame and the image type should not be FoxitPDFSDKPython2.Image.e_Unknown .
  [in] | frame_index | Frame index. Valid range: from 0 to (count-1). count is returned by function FoxitPDFSDKPython2.Image.GetFrameCount .

Returns
  None.

## ◆ SetKeyLabel()

def FoxitPDFSDKPython2.Signature.SetKeyLabel | ( |  | label_name,
|  |  | label_value
| ) |  |

Set the string for specified key label.

This function is recommended to be used before calling function FoxitPDFSDKPython2.Signature.StartSign for an unsigned signature.
This function is used to set string value for custom label of some key in signature dictionary. If no custom label is set, default labels will be used by Foxit PDF SDK. Please refer to comment of values starting from FoxitPDFSDKPython2.Signature.e_LabelNameSigner for more details.
If current signature is a time stamp signature, this function will do nothing.

Parameters

  [in] | label_name | Key label. Please refer to values starting from FoxitPDFSDKPython2.Signature.e_LabelNameSigner and this should be one of these values.
  [in] | label_value | New string value for key label. If this is an empty string, Foxit PDF SDK will use default label. Please refer to comment of values starting from FoxitPDFSDKPython2.Signature.e_LabelNameSigner for more details.

Returns
  None.

## ◆ SetKeyValue()

def FoxitPDFSDKPython2.Signature.SetKeyValue | ( |  | key,
|  |  | value
| ) |  |

Set the string value for specified key name.

This function is recommended to be used before calling function FoxitPDFSDKPython2.Signature.StartSign for an unsigned signature.
This function is used to set string value of some key in signature dictionary, such as signer, reason, location and so on.
If current signature is a time stamp signature, this function will do nothing.

Parameters

  [in] | key | Key name. Please refer to values starting from FoxitPDFSDKPython2.Signature.e_KeyNameSigner and this should be one of these values.
  [in] | value | New string value.

Returns
  None.

## ◆ SetSignTime()

def FoxitPDFSDKPython2.Signature.SetSignTime | ( |  | sign_time | ) |

Set time of signing.

This function is recommended to be used before calling function FoxitPDFSDKPython2.Signature.StartSign for an unsigned signature.

Parameters

  [in] | sign_time | The signing time.

Returns
  None.

## ◆ SetSubFilter()

def FoxitPDFSDKPython2.Signature.SetSubFilter | ( |  | sub_filter | ) |

Set sub filter.

Filter and sub filter are used to specify which registered signature callback object will be used to sign/verify current signature. User could should set filter and sub filter to use default signature callback in Foxit PDF SDK, or use other filter and sub fitler but please ensure that a signature callback object with non-default filter and sub filter should has been registered in Foxit PDF SDK before signing or verifying current signature. Filter and sub filter for default signature callback are:

- filter: "Adobe.PPKLite" and sub filter: "adbe.pkcs7.detached"
- filter: "Adobe.PPKLite" and sub filter: "adbe.pkcs7.sha1"
- filter: "Adobe.PPKLite" and sub filter: "ETSI.CAdES.detached"
- filter: "Adobe.PPKLite" and sub filter: "ETSI.RFC3161"

Parameters

  [in] | sub_filter | String for sub filter.

Returns
  None.

## ◆ StartSign() [1/3]

def FoxitPDFSDKPython2.Signature.StartSign | ( |  | cert_file_stream,
|  |  | cert_password,
|  |  | digest_algorithm,
|  |  | save_path,
|  |  | client_data,
|  |  | pause
| ) |  |

Start signing current signature if current signature is unsigned.

This function is used for an unsigned signature. Filter and sub filter keys of current signature specify the name of signature callback object which will be used to sign current signature. So before signing, please ensure current signature has valid filter and sub filter string values. If the filter and sub filter are one of following strings that means to use the default signature callback in Foxit PDF SDK:

- filter: "Adobe.PPKLite" and sub filter: "adbe.pkcs7.detached"
- filter: "Adobe.PPKLite" and sub filter: "adbe.pkcs7.sha1"
- filter: "Adobe.PPKLite" and sub filter: "ETSI.CAdES.detached"
- filter: "Adobe.PPKLite" and sub filter: "ETSI.RFC3161"

For other filter and sub filter or if user wants to use customized signature callback for above filter and sub filter, please ensure a customized signature callback has been registered to Foxit PDF SDK by function FoxitPDFSDKPython2.Library.RegisterSignatureCallback .
For PDF documents that are compliant with PDF/A specification, FoxitPDFSDKPython2.Library.SetDefaultICCProfilesPath is recommended to be called and enable embeding font by calling FoxitPDFSDKPython2.Signature.EnableEmbedFont before calling current function. It may take a long time to sign a signature, so Foxit PDF SDK uses a progressive process to do this.

Parameters

  [in] | cert_file_stream | A FoxitPDFSDKPython2.StreamCallback object which is implemented by user to access content of a certificate file which will be used for signing. This can be null if not necessary in custom signature callback. If default signature callback is to be used for signing current signature, a PFX certificate file can be used.
  [in] | cert_password | A password string used to open the cert file. If this is an empty string, that means no password is required.
  [in] | digest_algorithm | The algorithm of message digest for signed data. Please refer to values starting from FoxitPDFSDKPython2.Signature.e_DigestSHA1 and this should be one of these values.
  [in] | save_path | A full PDF file path for saving the signing result. The signed document would be saved to another PDF file.
  [in] | client_data | A user-defined object, which will be passed to call back functions in SignatureCallback . This is useless if the default callback object will be used to sign current signature. Default value: null.
  [in] | pause | Pause object which decides if the signing process needs to be paused. This can be null which means not to pause during the signing process. If this is not null, it should be a valid pause object implemented by user. Default value: null.

Returns
  A progressive object. Please check the rate of current progress by function FoxitPDFSDKPython2.Progressive.GetRateOfProgress . If the rate is not 100 yet, call function FoxitPDFSDKPython2.Progressive.Continue to continue the progress until the progress is finished.

Note
  This function does not support to save signed PDF document directly to the PDF file which is used to construct the related PDF document of current signature. In order to do so, user is recommended to do as following steps:
  Assume that the related PDF document object is constructed from a PDF file named "org.pdf".
  1. Use current function to save the signed result to an temporary file. Here, this temporary file is named as "temp.tmp".
  2. Ensure that the related PDF document object has destructed – which is equal to "close document".
  3. Remove "org.pdf" and rename "temp.tmp" to "org.pdf".
  Then user can open the signed PDF document to do other operation.

## ◆ StartSign() [2/3]

def FoxitPDFSDKPython2.Signature.StartSign | ( |  | cert_file_stream,
|  |  | cert_password,
|  |  | digest_algorithm,
|  |  | stream_callback,
|  |  | client_data,
|  |  | pause
| ) |  |

Start signing current signature if current signature is unsigned.

This function is used for an unsigned signature. Filter and sub filter keys of current signature specify the name of signature callback object which will be used to sign current signature. So before signing, please ensure current signature has valid filter and sub filter string values. If the filter and sub filter are one of following strings that means to use the default signature callback in Foxit PDF SDK:

- filter: "Adobe.PPKLite" and sub filter: "adbe.pkcs7.detached"
- filter: "Adobe.PPKLite" and sub filter: "adbe.pkcs7.sha1"
- filter: "Adobe.PPKLite" and sub filter: "ETSI.CAdES.detached"
- filter: "Adobe.PPKLite" and sub filter: "ETSI.RFC3161"

For sub filter "ETSI.CAdES.detached" and sub filter "ETSI.RFC3161", please ensure a default time stmap server has been set to TimeStampServerMgr if default signature callbacks for them will be used to do signing. For other filter and sub filter or if user wants to use customized signature callback for above filter and sub filter, please ensure a customized signature callback has been registered to Foxit PDF SDK by function FoxitPDFSDKPython2.Library.RegisterSignatureCallback .
For PDF documents that are compliant with PDF/A specification, FoxitPDFSDKPython2.Library.SetDefaultICCProfilesPath is recommended to be called and enable embeding font by calling FoxitPDFSDKPython2.Signature.EnableEmbedFont before calling current function. It may take a long time to sign a signature, so Foxit PDF SDK uses a progressive process to do this.

Parameters

  [in] | cert_file_stream | A FoxitPDFSDKPython2.StreamCallback object which is implemented by user to access content of a certificate file which will be used for signing. This can be null if not necessary in custom signature callback. If default signature callback is to be used for signing current signature, a PFX certificate file can be used.
  [in] | cert_password | A password string used to open the cert file. If this is an empty string, that means no password is required.
  [in] | digest_algorithm | The algorithm of message digest for signed data. Please refer to values starting from FoxitPDFSDKPython2.Signature.e_DigestSHA1 and this should be one of these values.
  [in] | stream_callback | A FoxitPDFSDKPython2.StreamCallback object which is implemented by user to save the signing result. The signed document would be saved to another PDF file.
  [in] | client_data | A user-defined object, which will be passed to call back functions in SignatureCallback . This is useless if the default callback object will be used to sign current signature. Default value: null.
  [in] | pause | Pause object which decides if the signing process needs to be paused. This can be null which means not to pause during the signing process. If this is not null, it should be a valid pause object implemented by user. Default value: null.

Returns
  A progressive object. Please check the rate of current progress by function FoxitPDFSDKPython2.Progressive.GetRateOfProgress . If the rate is not 100 yet, call function FoxitPDFSDKPython2.Progressive.Continue to continue the progress until the progress is finished.

Note
  This function does not support to save signed PDF document directly to the PDF file which is used to construct the related PDF document of current signature. In order to do so, user is recommended to do as following steps:
  Assume that the related PDF document object is constructed from a PDF file named "org.pdf".
  1. Use current function to save the signed result to an temporary file. Here, this temporary file is named as "temp.tmp".
  2. Ensure that the related PDF document object has destructed – which is equal to "close document".
  3. Remove "org.pdf" and rename "temp.tmp" to "org.pdf".
  Then user can open the signed PDF document to do other operation.

## ◆ StartSign() [3/3]

def FoxitPDFSDKPython2.Signature.StartSign | ( |  | cert_path,
|  |  | cert_password,
|  |  | digest_algorithm,
|  |  | stream_callback,
|  |  | client_data,
|  |  | pause
| ) |  |

Start signing current signature if current signature is unsigned.

This function is used for an unsigned signature. Filter and sub filter keys of current signature specify the name of signature callback object which will be used to sign current signature. So before signing, please ensure current signature has valid filter and sub filter string values. If the filter and sub filter are one of following strings that means to use the default signature callback in Foxit PDF SDK:

- filter: "Adobe.PPKLite" and sub filter: "adbe.pkcs7.detached"
- filter: "Adobe.PPKLite" and sub filter: "adbe.pkcs7.sha1"
- filter: "Adobe.PPKLite" and sub filter: "ETSI.CAdES.detached"
- filter: "Adobe.PPKLite" and sub filter: "ETSI.RFC3161"

For sub filter "ETSI.CAdES.detached" and sub filter "ETSI.RFC3161", please ensure a default time stmap server has been set to TimeStampServerMgr if default signature callbacks for them will be used to do signing. For other filter and sub filter or if user wants to use customized signature callback for above filter and sub filter, please ensure a customized signature callback has been registered to Foxit PDF SDK by function FoxitPDFSDKPython2.Library.RegisterSignatureCallback .
For PDF documents that are compliant with PDF/A specification, FoxitPDFSDKPython2.Library.SetDefaultICCProfilesPath is recommended to be called and enable embeding font by calling FoxitPDFSDKPython2.Signature.EnableEmbedFont before calling current function. It may take a long time to sign a signature, so Foxit PDF SDK uses a progressive process to do this.

Parameters

  [in] | cert_path | A full path of a certificate file (including file name and extension), which will be used for signing. This can be an empty string if not necessary in custom signature callback. When this file path is not empty, it should be a valid path. If default signature callback is to be used for signing current signature, this can be a PFX certificate file.
  [in] | cert_password | A password string used to open the cert file. If this is an empty string, that means no password is required.
  [in] | digest_algorithm | The algorithm of message digest for signed data. Please refer to values starting from FoxitPDFSDKPython2.Signature.e_DigestSHA1 and this should be one of these values.
  [in] | stream_callback | A FoxitPDFSDKPython2.StreamCallback object which is implemented by user to save the signing result. The signed document would be saved to another PDF file.
  [in] | client_data | A user-defined object, which will be passed to call back functions in SignatureCallback . This is useless if the default callback object will be used to sign current signature. Default value: null.
  [in] | pause | Pause object which decides if the signing process needs to be paused. This can be null which means not to pause during the signing process. If this is not null, it should be a valid pause object implemented by user. Default value: null.

Returns
  A progressive object. Please check the rate of current progress by function FoxitPDFSDKPython2.Progressive.GetRateOfProgress . If the rate is not 100 yet, call function FoxitPDFSDKPython2.Progressive.Continue to continue the progress until the progress is finished.

Note
  This function does not support to save signed PDF document directly to the PDF file which is used to construct the related PDF document of current signature. In order to do so, user is recommended to do as following steps:
  Assume that the related PDF document object is constructed from a PDF file named "org.pdf".
  1. Use current function to save the signed result to an temporary file. Here, this temporary file is named as "temp.tmp".
  2. Ensure that the related PDF document object has destructed – which is equal to "close document".
  3. Remove "org.pdf" and rename "temp.tmp" to "org.pdf".
  Then user can open the signed PDF document to do other operation.

## ◆ StartVerify()

def FoxitPDFSDKPython2.Signature.StartVerify | ( |  | client_data,
|  |  | pause
| ) |  |

Start verifying the intergrity of current signature if current signature is signed.

This function is used for a signed signature. Filter and sub filter keys of current signature specify the name of signature callback object which will be used to verify current signature. So before verifying, please ensure: the necessary signature callback object has been registered by function FoxitPDFSDKPython2.Library.RegisterSignatureCallback . If the filter and sub filter of current signed signature are one of following strings that means to use the default signature callback in Foxit PDF SDK and user does not need to register one for them:

- filter: "Adobe.PPKLite" and sub filter: "adbe.pkcs7.detached"
- filter: "Adobe.PPKLite" and sub filter: "adbe.pkcs7.sha1"
- filter: "Adobe.PPKLite" and sub filter: "ETSI.CAdES.detached"
- filter: "Adobe.PPKLite" and sub filter: "ETSI.RFC3161"

It may take a long time to verify a signature, so Foxit PDF SDK uses a progressive process to do this.
From 7.0, this function is only used to verify the intergrity of a signature. To check if a signature is valid or not, please refer to class LTVVerifier .

Parameters

  [in] | client_data | A user-defined object, which will be passed to call back functions in SignatureCallback . This is useless if the default callback object will be used to verify current signature. Default value: null.
  [in] | pause | Pause object which decides if the verifying process needs to be paused. This can be null which means not to pause during the verifying process. If this is not null, it should be a valid pause object implemented by user. Default value: null.

Returns
  A progressive object. Please check the rate of current progress by function FoxitPDFSDKPython2.Progressive.GetRateOfProgress . If the rate is not 100 yet, call function FoxitPDFSDKPython2.Progressive.Continue to continue the progress until the progress is finished.

## Member Data Documentation

## ◆ e_FieldMDPActionExclude

FoxitPDFSDKPython2.Signature.e_FieldMDPActionExclude = _fsdk.Signature_e_FieldMDPActionExclude
| static

Flags of form fields (except specified form fields) will be set read-only.

Note
  "Specified form fields" can be get/set by functions FoxitPDFSDKPython2.Signature.GetFieldMDPActionFields and FoxitPDFSDKPython2.Signature.SetFieldMDPActionFields . Please refer to these functions for more details.

## ◆ e_FieldMDPActionInclude

FoxitPDFSDKPython2.Signature.e_FieldMDPActionInclude = _fsdk.Signature_e_FieldMDPActionInclude
| static

Specified form fields' flags will be set read-only.

Note
  "Specified form fields" can be get/set by functions FoxitPDFSDKPython2.Signature.GetFieldMDPActionFields and FoxitPDFSDKPython2.Signature.SetFieldMDPActionFields . Please refer to these functions for more details.

## ◆ e_LabelNameDN

FoxitPDFSDKPython2.Signature.e_LabelNameDN = _fsdk.Signature_e_LabelNameDN
| static

Signature key name for distinguish name.

Note
  Default label name for distinguish name is "DN: " in Foxit PDF SDK.

## ◆ e_LabelNameLocation

FoxitPDFSDKPython2.Signature.e_LabelNameLocation = _fsdk.Signature_e_LabelNameLocation
| static

Signature label name for location.

Note
  Default label name for location is "Location: " in Foxit PDF SDK.

## ◆ e_LabelNameProducer

FoxitPDFSDKPython2.Signature.e_LabelNameProducer = _fsdk.Signature_e_LabelNameProducer
| static

Signature key name for producer name.

Note
  Default label name for producer name is empty in Foxit PDF SDK.

## ◆ e_LabelNameReason

FoxitPDFSDKPython2.Signature.e_LabelNameReason = _fsdk.Signature_e_LabelNameReason
| static

Signature label name for reason.

Note
  Default label name for reason is "Reason: " in Foxit PDF SDK.

## ◆ e_LabelNameSigner

FoxitPDFSDKPython2.Signature.e_LabelNameSigner = _fsdk.Signature_e_LabelNameSigner
| static

Signature label name for signer.

Note
  Default label name for signer is "Digitally signed by " in Foxit PDF SDK.

## ◆ e_LabelNameSignTime

FoxitPDFSDKPython2.Signature.e_LabelNameSignTime = _fsdk.Signature_e_LabelNameSignTime
| static

Signature label name for sign time.

Note
  Default label name for sign time is "Date: " in Foxit PDF SDK.