# SignDoc Class

> Implementation of the PDF SignDoc function.

- Product: Adobe PDF Library 18
- Language: Java
- Version: APDFL18.0.5PlusP2e
- HTML page: https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/SignDoc
- Version index: https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/llms.txt

```java
class SignDoc
```

**Namespace:** `com::datalogics::PDFL`

## Description

Implementation of the PDF SignDoc function. Use the SignDoc object to digitally sign a document

**Uses types:** [`CancelProc`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/CancelProc.md), [`Document`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Document.md), [`ProgressMonitor`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/ProgressMonitor.md), [`Rect`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Rect.md)

## Constructors

### SignDoc

```java
com.datalogics.PDFL.SignDoc.SignDoc()
```

*constructor*

Creates an empty SignDoc object and initializes memory for its parameters.

## Methods

### addDigitalSignature

```java
void com.datalogics.PDFL.SignDoc.addDigitalSignature(Document document)
```

**Parameters**

- `document` ([`Document`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Document.md)): The Document to be digitally signed.

**Returns:** `void`

Adds a digital signature using the specified credentials. If the document has not been previously signed, signs and saves the entire document. If the document has been previously signed, signs and saves only the portions of the document that have changed. If the document has been previously signed and the path to which the file is saved is NULL or the same as the path specified by the parameter, doc, signs and copies the document, saving only the portions of the document that have changed.

### addSigPolicy

```java
int com.datalogics.PDFL.SignDoc.addSigPolicy(String oid)
```

**Parameters**

- `oid` (`String`): Object Identifier (OID) of the signature policy to add.

**Returns:** `int`

- The number of signature policies added to the signature.

Add a signature policy to the PAdES signature being generated. Signature policies may be applied to PAdES signatures, only. The signature type must be set to PADES prior to adding a policy.

### addSigPolicyQualifierURI

```java
void com.datalogics.PDFL.SignDoc.addSigPolicyQualifierURI(String uri)
```

**Parameters**

- `uri` (`String`): URI pointing to the signature policy document.

**Returns:** `void`

Qualify an existing signature policy with a Signature Policy URI (SPuri) qualifier. A policy must be added via AddSigPolicy prior to calling this method. A signature policy may be qualified by no more than one policy qualifier.

### addSigPolicyQualifierUserNotice

```java
void com.datalogics.PDFL.SignDoc.addSigPolicyQualifierUserNotice(String displayText, String org, java.util.List< Long > noticeNos)
```

**Parameters**

- `displayText` (`String`): Text to display to the user when the signature is verified.
- `org` (`String`): Organization that prepared the notice.
- `noticeNos` (`java.util.List< Long >`): Group of integers that identify textual statements prepared by the organization.

**Returns:** `void`

Qualify an existing signature policy with a Signature Policy UserNotice (SPUserNotice) qualifier. A policy must be added via AddSigPolicy prior to calling this method. A signature policy may be qualified by no more than one policy qualifier. The displayText and org attributes can be defined independent of each other. However, a valid org attribute must be defined in order to qualify a PAdES signature policy with the noticeNos attribute.

### createCancelProc

```java
void com.datalogics.PDFL.SignDoc.createCancelProc(CancelProc cancelProc)
```

**Parameters**

- `cancelProc` ([`CancelProc`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/CancelProc.md)): The CancelProc to receive cancel callbacks during signing.

**Returns:** `void`

Creates and registers a cancel callback for the signing operation.

### createProgressMonitor

```java
void com.datalogics.PDFL.SignDoc.createProgressMonitor(ProgressMonitor progMon)
```

**Parameters**

- `progMon` ([`ProgressMonitor`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/ProgressMonitor.md)): The ProgressMonitor to receive progress callbacks during signing.

**Returns:** `void`

Creates and registers a progress monitor for the signing operation.

### delete

```java
synchronized void com.datalogics.PDFL.SignDoc.delete(Boolean disposing)
```

*protected*

**Parameters**

- `disposing` (`Boolean`)

**Returns:** `synchronized void`

### delete

```java
synchronized void com.datalogics.PDFL.SignDoc.delete()
```

**Returns:** `synchronized void`

### finalize

```java
void com.datalogics.PDFL.SignDoc.finalize()
```

*protected*

**Returns:** `void`

### getCredentialDataFormat

```java
CredentialDataFmt com.datalogics.PDFL.SignDoc.getCredentialDataFormat()
```

**Returns:** `CredentialDataFmt`

- Format of user-credentials used to sign the document.

Get the value of the credential data format option.

### getDigestCategory

```java
DigestCategory com.datalogics.PDFL.SignDoc.getDigestCategory()
```

**Returns:** `DigestCategory`

- Member of the enumeration DigestCategory, which option to set.

Get the value of the digest category.

### getDocSignType

```java
SignatureType com.datalogics.PDFL.SignDoc.getDocSignType()
```

**Returns:** `SignatureType`

- Member of the enumeration CSignatureType set in a document.

Get the type of signature added to a document.

### getFieldID

```java
SignatureFieldID com.datalogics.PDFL.SignDoc.getFieldID()
```

**Returns:** `SignatureFieldID`

- SignatureFieldID choice currently set

Get the field identifier used to determine the form field that will contain the digital signature.

### getFieldName

```java
String com.datalogics.PDFL.SignDoc.getFieldName()
```

**Returns:** `String`

- Fully qualified field name. May return NULL based on the SignatureFieldID attribute defined by the user.

Get the form field fully qualified name of the form field that contains the digital signature.

### getOutputPath

```java
String com.datalogics.PDFL.SignDoc.getOutputPath()
```

**Returns:** `String`

Get Output Path The path to which the file is saved. A path must be specified in case a full save (PDSaveFull) is needed. In case of an incremental save (PDSaveIncremental), newPath should be set to NULL. If a full save (PDSaveFull) is performed and newPath is the same as the file's original path, the new file is saved to a file system determined temporary path. The old file is then deleted and the new file is renamed to newPath.

### getSignatureBoxPageNumber

```java
long com.datalogics.PDFL.SignDoc.getSignatureBoxPageNumber()
```

**Returns:** `long`

- The page number on which signature field's widget annotation is created. A value of zero is returned if page number was not set.

Get the page number on which the widget annotation of the signature field is created.

### getSignatureBoxRectangle

```java
Rect com.datalogics.PDFL.SignDoc.getSignatureBoxRectangle()
```

**Returns:** [`Rect`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Rect.md)

- Dimension of the annotation rectangle of the signature field being created. A value of {0,0,0,0} is returned if annotation rectangle dimension was not set.

Get the dimension of the annotation rectangle of the signature field being created.

### setCredentialDataFormat

```java
void com.datalogics.PDFL.SignDoc.setCredentialDataFormat(CredentialDataFmt value)
```

**Parameters**

- `value` (`CredentialDataFmt`): Encoding format of credentials used to sign a document.

**Returns:** `void`

Set the value of the credential data format option.

### setDigestCategory

```java
void com.datalogics.PDFL.SignDoc.setDigestCategory(DigestCategory value)
```

**Parameters**

- `value` (`DigestCategory`): Cryptographic hash function to use for generating message digests.

**Returns:** `void`

Set the value of the digest category.

### setDocSignType

```java
void com.datalogics.PDFL.SignDoc.setDocSignType(SignatureType value)
```

**Parameters**

- `value` (`SignatureType`): Member of the enumeration CSignatureType to be added to a document.

**Returns:** `void`

Set the type of signature to be added to a document.

### setFieldID

```java
void com.datalogics.PDFL.SignDoc.setFieldID(SignatureFieldID value)
```

**Parameters**

- `value` (`SignatureFieldID`): Identifier to determine the form field that will contain the digital signature.

**Returns:** `void`

Set the field identifier used to determine the form field that will contain the digital signature.

### setFieldName

```java
void com.datalogics.PDFL.SignDoc.setFieldName(String name)
```

**Parameters**

- `name` (`String`): Fully qualified name of the form field that will contain the digital signature.

**Returns:** `void`

Set the form field fully qualified name option.

### setFieldObject

```java
void com.datalogics.PDFL.SignDoc.setFieldObject(int aValue, int bValue)
```

**Parameters**

- `aValue` (`int`): a value of the CosObject.
- `bValue` (`int`): b value of the CosObject.

**Returns:** `void`

Set the form field CosObject option.

### setNonPfxPassPhrase

```java
void com.datalogics.PDFL.SignDoc.setNonPfxPassPhrase(String passPhrase, long passphraseSize, CredentialStorageFmt storageFmt)
```

**Parameters**

- `passPhrase` (`String`): Passphrase used to encrypt Non-PFX private key. Should be set to NULL if unencrypted.
- `passphraseSize` (`long`): Passphrase size in bytes. Shall be set to 0 if private key is unencrypted or passphrase is stored on disk.
- `storageFmt` (`CredentialStorageFmt`): Storage format for passphrase.

**Returns:** `void`

Set the passphrase used to decrypt Non-PFX credentials.

Note: The passphrase provided must use the exact same character encoding used to encrypt the private key. The application makes no effort whatsoever to re-encode the same.

### setNonPfxPrivateKey

```java
void com.datalogics.PDFL.SignDoc.setNonPfxPrivateKey(String privateKey, long keySize, CredentialStorageFmt storageFmt)
```

**Parameters**

- `privateKey` (`String`): Private key.
- `keySize` (`long`): Size of private key in bytes. Shall be set to 0 if key is stored on disk.
- `storageFmt` (`CredentialStorageFmt`): Storage format for private key.

**Returns:** `void`

Set the private key for Non-PFX credentials..

### setNonPfxSignerCert

```java
void com.datalogics.PDFL.SignDoc.setNonPfxSignerCert(String signerCert, long certSize, CredentialStorageFmt storageFmt)
```

**Parameters**

- `signerCert` (`String`): Signer certificate
- `certSize` (`long`): Size of signer certificate in bytes. Shall be set to 0 if certificate is stored on disk.
- `storageFmt` (`CredentialStorageFmt`): Storage format for the signer certificate.

**Returns:** `void`

Set the signer certificate for Non-PFX credentials.

### setOutputPath

```java
void com.datalogics.PDFL.SignDoc.setOutputPath(String newPath)
```

**Parameters**

- `newPath` (`String`)

**Returns:** `void`

Set Output Path The path to which the file is saved. A path must be specified in case a full save (PDSaveFull) is needed. In case of an incremental save (PDSaveIncremental), newPath should be set to NULL. If a full save (PDSaveFull) is performed and newPath is the same as the file's original path, the new file is saved to a file system determined temporary path. The old file is then deleted and the new file is renamed to newPath.

### setPfxCredentials

```java
void com.datalogics.PDFL.SignDoc.setPfxCredentials(String credentials, CredentialStorageFmt storageFmt)
```

**Parameters**

- `credentials` (`String`): Credentials in PFX/PKCS#12 file format.
- `storageFmt` (`CredentialStorageFmt`): Storage format for the signer certificate. (Only OnDisk is allowed for this option)

**Returns:** `void`

Set PFX/PKCS#12 credentials.

### setPfxPassPhrase

```java
void com.datalogics.PDFL.SignDoc.setPfxPassPhrase(String passphrase, long passphraseSize, CredentialStorageFmt storageFmt)
```

**Parameters**

- `passphrase` (`String`): Passphrase used to encrypt PFX/PKCS#12 credentials. Shall be set to NULL if credentials are unencrypted.
- `passphraseSize` (`long`): Passphrase size in bytes. Shall be set to 0 if PFX credentials are unencrypted or passphrase is stored on disk.
- `storageFmt` (`CredentialStorageFmt`): Storage format for PFX/PKCS#12 credentials.

**Returns:** `void`

Set the passphrase used to decrypt PFX/PKCS#12 credentials. Note: The passphrase provided must use the exact same character encoding used to encrypt the PFX credentials. The application makes no effort whatsoever to re-encode the same.

### setSignatureBoxPageNumber

```java
void com.datalogics.PDFL.SignDoc.setSignatureBoxPageNumber(long value)
```

**Parameters**

- `value` (`long`): Page number on which to create the widget annotation.

**Returns:** `void`

Set the page number on which the widget annotation of the signature field is created.

### setSignatureBoxRectangle

```java
void com.datalogics.PDFL.SignDoc.setSignatureBoxRectangle(Rect rect)
```

**Parameters**

- `rect` ([`Rect`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Rect.md)): Dimension of the annotation rectangle of the signature field.

**Returns:** `void`

Set the dimension of the annotation rectangle of the signature field being created.

### setSignerInfo

```java
void com.datalogics.PDFL.SignDoc.setSignerInfo(String logoFilePath, float logoOpacity, String name, String location, String reason, String contactInfo, DisplayTraits displayTraits)
```

**Parameters**

- `logoFilePath` (`String`): Image to display as part of signature appearance.
- `logoOpacity` (`float`): Opacity of image to display as part of signature appearance.
- `name` (`String`): Name of the person or authority signing the document.
- `location` (`String`): CPU host name or physical location of the signing.
- `reason` (`String`): Reason for signing the document.
- `contactInfo` (`String`): Information provided by the signer to enable recipients to contact signer for signature verification.
- `displayTraits` (`DisplayTraits`): Fields to display as part of signature appearance.

**Returns:** `void`

Set Signer Info.
