| FoxitPDFSDKforWeb v11.1.0 Archives Foxit PDF SDK for Web

Public Member Functions | List of all members
PDFSignature Class Reference
PDF » form

Represents a signature field in a PDF form, providing methods for verification and retrieval of signature information. More...

Inheritance diagram for PDFSignature:

## Public Member Functions
async | getByteRange ()
| Retrieves the byte range of the current signature. More...
async | getFilter ()
| Retrieves the filter of the current signature. More...
async | getImage ()
| Retrieves the signature image data as a Blob. More...
async | getPagingSealConfig ()
| Retrieves the paging seal configuration for the current signature. More...
async | getSignatureType ()
| Retrieves the signature type. More...
async | getSigner ()
| Retrieves the signer of the current signature. More...
async | getSignInfo ()
| Retrieves the signature information for the field. More...
async | getSubfilter ()
| Retrieves the subfilter of the current signature. More...
async | isLast ()
| Checks whether the current signature is the last one. More...
async | isSigned ()
| Checks whether the current signature is signed. More...
async | verify (options:boolean|SignatureVerificationOptions={})
| Verifies the signature of a PDF form field, returning the result of the verification as an integer status code. More...
Public Member Functions inherited from PDFFormField
async | addOption (item:ChoiceOptionItem)
| Adds an option to the end of the list box or combo box. More...
async | deleteOption (index:number)
| Deletes an option by index from the list box or combo box. More...
| describeFieldFlags ()
| Retrieves the flag options for the current field. More...
| getAdditionalAction ()
| Retrives the additional action object. More...
| getAlignment ()
| Retrieves the field's alignment. More...
async | getAlternateName ()
| Get alternate name. More...
| getDefaultValue ()
| Retrieves the default value of the field. More...
| getExtType ()
| Retrieves the extended type information for the current form field. More...
| getFlags ()
| Retrieves the field's flags. More...
| getMappingName ()
| Get mapping name. More...
| getMaxLength ()
| Retrieves the maximum length of the text field. More...
| getName ()
| Retrives the name of the form field. More...
| getOptions ()
| Retrieves combo box and list box options. More...
| getOptionsSize ()
| Retrieves the number of options available in the list box or combo box. More...
| getType ()
| Get form field's type. More...
| getValue ()
| Get field value. More...
async | getWidget (index:number)
| Get widget annot with specified index. Please call PDFFormField.getWidgetsCount to get count. More...
| getWidgetsCount ()
| Get the count of field's controls. More...
async | insertOption (index:number, item:ChoiceOptionItem)
| Inserts an option at the specified index. More...
| isCheckedByDefault ()
| Checks if the field is checked by default. More...
async | isReadonly ()
| Check if the field is read only. More...
async | isRequired ()
| Check if the field is required. More...
async | moveOption (srcIndex:number, destIndex:number)
| Moves an option from one index to another. More...
async | selectOption (index:number)
| Selects an option by index in the list box or combo box. More...
async | setAlignment (alignment:number)
| Sets the field's alignment (not applicable for signature fields). More...
async | setAlternateName (alternateName:string)
| Set alternate name. More...
| setCheckedByDefault (checked:boolean)
| Sets the default checked state of the field. More...
| setDefaultValue (defaultValue:string)
| Sets the default value of the field. More...
async | setMappingName (mappingName:string)
| Set mapping name. (Not support signature field). More...
async | setMaxLength (maxLength:number)
| Sets the maximum length for the text field. More...
async | setOptions (options:{ label:string;value:string;selected:boolean;defaultSelected:boolean;}[])
| Sets the options (items) for a list box or combo box. More...
| setValue (value:string, isTriggerEvent=true)
| Set field value. More...
| updateFlagByOptions (options:Partial< FieldFlagOptions >)
| Updates the field's flags based on the given options. More...
async | updateOption (index:number, itemOptions:Partial< ChoiceOptionItem >)
| Updates an option at a specified index. More...
Public Member Functions inherited from Disposable
| addDestroyHook (...hooks)
| Add a function to destroyHooks list, which will be called during destroy. More...
| destroy ()
| ownsTo (owner)
| Establishes an ownership relationship where this instance will be destroyed when the owner is destroyed. Additionally, the owner will be automatically removed from the destroyHooks list when this instance is destroyed. More...

## Detailed Description

Represents a signature field in a PDF form, providing methods for verification and retrieval of signature information.

Since
  11.0.0

## Member Function Documentation

## ◆ getByteRange()

async PDFSignature::getByteRange | ( |  | ) |
| inline

Retrieves the byte range of the current signature.

Returns
  Promise<number[]> - The byte range of the signature if signed; otherwise, an empty array.

Since
  11.0.0

Implements ISignatureField.

## ◆ getFilter()

async PDFSignature::getFilter | ( |  | ) |
| inline

Retrieves the filter of the current signature.

Filter and subfilter specify which registered signature callback object will be used to sign/verify the current signature.

Returns
  Promise<string|undefined> - The filter of the signature if signed; otherwise, undefined.

Since
  11.0.0

Implements ISignatureField.

## ◆ getImage()

async PDFSignature::getImage | ( |  | ) |
| inline

Retrieves the signature image data as a Blob.

Returns
  Promise<Blob | undefined> - A promise that resolves to the signature image data as a Blob or undefined if no image data is available.

Since
  11.0.0

## ◆ getPagingSealConfig()

async PDFSignature::getPagingSealConfig | ( |  | ) |
| inline

Retrieves the paging seal configuration for the current signature.

Returns
  Promise<PagingSealConfig|undefined> - A promise that resolves to the paging seal configuration if the signature is paging seal; otherwise, undefined.

Since
  11.0.0

## ◆ getSignatureType()

async PDFSignature::getSignatureType | ( |  | ) |
| inline

Retrieves the signature type.

Returns
  Promise<SignatureType> - Retrieves the signature type.

Since
  11.0.0

## ◆ getSigner()

async PDFSignature::getSigner | ( |  | ) |
| inline

Retrieves the signer of the current signature.

Returns
  Promise<string> - The signer of the signature or an empty string if not signed.

Since
  11.0.0

Implements ISignatureField.

## ◆ getSignInfo()

async PDFSignature::getSignInfo | ( |  | ) |
| inline

Retrieves the signature information for the field.

Returns
  Promise<FormSignatureInfo> - Information about the signature.

Since
  11.0.0

Implements IFormSignatureField.

## ◆ getSubfilter()

async PDFSignature::getSubfilter | ( |  | ) |
| inline

Retrieves the subfilter of the current signature.

Filter and subfilter specify which registered signature callback object will be used to sign/verify the current signature.

Returns
  Promise<string|undefined> - The subfilter of the signature if signed; otherwise, undefined.

Since
  11.0.0

Implements ISignatureField.

## ◆ isLast()

async PDFSignature::isLast | ( |  | ) |
| inline

Checks whether the current signature is the last one.

Returns
  Promise<boolean> - A promise that resolves to true if the current signature is the last one, otherwise false.

Since
  11.0.0

## ◆ isSigned()

async PDFSignature::isSigned | ( |  | ) |
| inline

Checks whether the current signature is signed.

Returns
  Promise<boolean> - True if the signature is signed; otherwise, false.

Since
  11.0.0

Implements ISignatureField.

## ◆ verify()

async PDFSignature::verify | ( | options:boolean| | SignatureVerificationOptions = `{}` | ) |
| inline

Verifies the signature of a PDF form field, returning the result of the verification as an integer status code.

Example::

const signatureField = await form.getField("Signature field name");
// This is an example of a signature service address
const signature_server = 'https://webviewer-demo.foxitsoftware.com/signature'; // or your own address
const result = await signatureField.verify({
force: false,
handler: async (signatureField, plainContent, signedData, hasDataOutOfScope) => { // verify handler
const filter = await signatureField.getFilter();
const subfilter = await signatureField.getSubfilter();
const signer = await signatureField.getSigner();
const formdata = new FormData();
formdata.append("filter", filter);
formdata.append("subfilter", subfilter);
formdata.append("signer", signer);
formdata.append("plainContent", new Blob([plainContent]), "plainContent");
formdata.append("signedData", new Blob([signedData]), "signedData");
const response = await fetch(signature_server + '/verify', {
method: 'POST',
body: formdata
});
return parseInt(await response.text());
}
});

Parameters

  options | boolean|SignatureVerificationOptions - Configuration options for the verification process，if the options is a boolean, it will be treated as the force parameter.

Returns
  Promise<number> - The verification result code. Please refer to Signature_State.

Since
  11.0.0

Exceptions

  Error | if the signature field is not signed.
  Error | if the verification handler is not specified.

@2026 Foxit Software Incorporated. All rights reserved.