# SignDoc Class

> Implementation of the PDF SignDoc function.

- Product: Adobe PDF Library 21
- Language: .NET Framework
- Version: APDFL21.0.0PlusP1e
- HTML page: https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/SignDoc
- Version index: https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/llms.txt

```csharp
class SignDoc : SystemIDisposable
```

**Namespace:** `Datalogics::PDFL`

**Inherits from:** `SystemIDisposable`

## Description

Implementation of the PDF SignDoc function.

Use the SignDoc object to digitally sign a document

**Uses types:** [`CancelProc`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/CancelProc.md), [`CredentialDataFmt`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/enum/CredentialDataFmt.md), [`CredentialStorageFmt`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/enum/CredentialStorageFmt.md), [`DigestCategory`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/enum/DigestCategory.md), [`DisplayTraits`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/enum/DisplayTraits.md), [`Document`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Document.md), [`ProgressMonitor`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/ProgressMonitor.md), [`Rect`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Rect.md), [`SignatureFieldID`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/enum/SignatureFieldID.md), [`SignatureType`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/enum/SignatureType.md)

## Constructors

### SignDoc

```csharp
Datalogics.PDFL.SignDoc.SignDoc()
```

*constructor*

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

## Properties

### CredentialDataFormat

```csharp
CredentialDataFmt Datalogics.PDFL.SignDoc.CredentialDataFormat { get; set; }
```

Get the value of the credential data format option.

### DigestCategory

```csharp
DigestCategory Datalogics.PDFL.SignDoc.DigestCategory { get; set; }
```

Get the value of the digest category.

### DocSignType

```csharp
SignatureType Datalogics.PDFL.SignDoc.DocSignType { get; set; }
```

Get the type of signature added to a document.

### FieldID

```csharp
SignatureFieldID Datalogics.PDFL.SignDoc.FieldID { get; set; }
```

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

### FieldName

```csharp
string Datalogics.PDFL.SignDoc.FieldName { get; set; }
```

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

### OutputPath

```csharp
string Datalogics.PDFL.SignDoc.OutputPath { get; set; }
```

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.

### SignatureBoxPageNumber

```csharp
uint Datalogics.PDFL.SignDoc.SignatureBoxPageNumber { get; set; }
```

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

### SignatureBoxRectangle

```csharp
Rect Datalogics.PDFL.SignDoc.SignatureBoxRectangle { get; set; }
```

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

## Methods

### AddDigitalSignature

```csharp
void Datalogics.PDFL.SignDoc.AddDigitalSignature(Document document)
```

**Parameters**

- `document` ([`Document`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/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

```csharp
int 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

```csharp
void 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

```csharp
void Datalogics.PDFL.SignDoc.AddSigPolicyQualifierUserNotice(string displayText, string org, System.Collections.Generic.IList< System.Int64 > noticeNos)
```

**Parameters**

- `displayText` (`string`): Text to display to the user when the signature is verified.
- `org` (`string`): Organization that prepared the notice.
- `noticeNos` (`System.Collections.Generic.IList< System.Int64 >`): 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

```csharp
void Datalogics.PDFL.SignDoc.CreateCancelProc(CancelProc cancelProc)
```

**Parameters**

- `cancelProc` ([`CancelProc`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/CancelProc.md)): The CancelProc to receive cancel callbacks during signing.

**Returns:** `void`

Creates and registers a cancel callback for the signing operation.

### CreateProgressMonitor

```csharp
void Datalogics.PDFL.SignDoc.CreateProgressMonitor(ProgressMonitor progMon)
```

**Parameters**

- `progMon` ([`ProgressMonitor`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/ProgressMonitor.md)): The ProgressMonitor to receive progress callbacks during signing.

**Returns:** `void`

Creates and registers a progress monitor for the signing operation.

### Dispose

```csharp
void Datalogics.PDFL.SignDoc.Dispose()
```

**Returns:** `void`

### SetFieldObject

```csharp
void 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

```csharp
void Datalogics.PDFL.SignDoc.SetNonPfxPassPhrase(string passPhrase, uint passphraseSize, CredentialStorageFmt storageFmt)
```

**Parameters**

- `passPhrase` (`string`): Passphrase used to encrypt Non-PFX private key. Should be set to NULL if unencrypted.
- `passphraseSize` (`uint`): Passphrase size in bytes. Shall be set to 0 if private key is unencrypted or passphrase is stored on disk.
- `storageFmt` ([`CredentialStorageFmt`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/enum/CredentialStorageFmt.md)): 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

```csharp
void Datalogics.PDFL.SignDoc.SetNonPfxPrivateKey(string privateKey, uint keySize, CredentialStorageFmt storageFmt)
```

**Parameters**

- `privateKey` (`string`): Private key.
- `keySize` (`uint`): Size of private key in bytes. Shall be set to 0 if key is stored on disk.
- `storageFmt` ([`CredentialStorageFmt`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/enum/CredentialStorageFmt.md)): Storage format for private key.

**Returns:** `void`

Set the private key for Non-PFX credentials..

### SetNonPfxSignerCert

```csharp
void Datalogics.PDFL.SignDoc.SetNonPfxSignerCert(string signerCert, uint certSize, CredentialStorageFmt storageFmt)
```

**Parameters**

- `signerCert` (`string`): Signer certificate
- `certSize` (`uint`): Size of signer certificate in bytes. Shall be set to 0 if certificate is stored on disk.
- `storageFmt` ([`CredentialStorageFmt`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/enum/CredentialStorageFmt.md)): Storage format for the signer certificate.

**Returns:** `void`

Set the signer certificate for Non-PFX credentials.

### SetPfxCredentials

```csharp
void Datalogics.PDFL.SignDoc.SetPfxCredentials(string credentials, CredentialStorageFmt storageFmt)
```

**Parameters**

- `credentials` (`string`): Credentials in PFX/PKCS#12 file format.
- `storageFmt` ([`CredentialStorageFmt`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/enum/CredentialStorageFmt.md)): Storage format for the signer certificate. (Only OnDisk is allowed for this option)

**Returns:** `void`

Set PFX/PKCS#12 credentials.

### SetPfxPassPhrase

```csharp
void Datalogics.PDFL.SignDoc.SetPfxPassPhrase(string passphrase, uint passphraseSize, CredentialStorageFmt storageFmt)
```

**Parameters**

- `passphrase` (`string`): Passphrase used to encrypt PFX/PKCS#12 credentials. Shall be set to NULL if credentials are unencrypted.
- `passphraseSize` (`uint`): Passphrase size in bytes. Shall be set to 0 if PFX credentials are unencrypted or passphrase is stored on disk.
- `storageFmt` ([`CredentialStorageFmt`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/enum/CredentialStorageFmt.md)): 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.

### SetSignerInfo

```csharp
void 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`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/enum/DisplayTraits.md)): Fields to display as part of signature appearance.

**Returns:** `void`

Set Signer Info.
