---
title: "Sign PDF document with certificate | Nutrient .NET SDK"
canonical_url: "https://www.nutrient.io/guides/dotnet/signatures/digital-signatures/certify-a-document/"
md_url: "https://www.nutrient.io/guides/dotnet/signatures/digital-signatures/certify-a-document.md"
last_updated: "2026-05-20T07:45:28.987Z"
description: "Learn how to certify PDF documents using Nutrient .NET SDK (formerly GdPicture.NET), including adding, removing, and getting certificate properties securely."
---

# Sign PDF documents with a certificate in C#

Nutrient.NET SDK (formerly GdPicture.NET) enables you to do the following:

- [Certify a PDF document](#certifying-a-pdf-document).

- [Get certification properties](#getting-the-certificate-properties).

- [Remove a certificate](#removing-a-certificate-from-a-pdf-document).

- [Add a certificate from other sources](#certifying-a-pdf-document-from-other-sources).

## Certifying a PDF document

To sign a PDF document with a certificate, follow these steps:

1. Create a digital ID or use an already created one.

2. Set the certificate contained in the digital ID stored in the `PCKS#12` file or a `Stream` object with the [`SetSignatureCertificateFromP12` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~SetSignatureCertificateFromP12.html).

3. Recommended: Specify the certificate information with the [`SetSignatureInfo` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~SetSignatureInfo.html). It requires the following string parameters:
   - `Name` — The person or authority certifying the document.
   - `Reason` — The reason for certifying.
   - `Location` — The physical location where the certificate was added.
   - `ContactInfo` — The contact information.

4. Use the [`ApplySignature` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~ApplySignature.html) to apply the certificate using the specified settings and save the PDF document to a file or a `Stream` object. This method requires the following parameters:
   - `OutputFileName` or `OutputStream` — Either the path of the output file or a `Stream` object.
   - `SignatureMode` — A member of the [`PdfSignatureMode` enumeration](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.PdfSignatureMode.html) that specifies the electronic signature technology used in the process.
   - `Linearization` — A Boolean value that specifies if the output PDF document is linearized.

You can only add digital signatures to non-encrypted documents.

To certify a PDF document, use the following code:

### C#

```csharp

using GdPicturePDF gdPicturePDF = new GdPicturePDF();
gdPicturePDF.LoadFromFile(@"C:\temp\source.pdf");
// Set the certificate from a file.
gdPicturePDF.SetSignatureCertificateFromP12(@"C:\temp\certificate.pfx", "nutrient");
// Add additional signature information.
gdPicturePDF.SetSignatureInfo("John Smith", "Confidential", "Vienna (Austria)",
    "JohnSmith@nutrient.io");
// Save the output to a file.
gdPicturePDF.ApplySignature(@"C:\temp\output.pdf",
    PdfSignatureMode.PdfSignatureModeAdobePPKMS, false);

```

### VB.NET

```vb

Using gdPicturePDF As GdPicturePDF = New GdPicturePDF()
    gdPicturePDF.LoadFromFile("C:\temp\source.pdf")
    ' Set the certificate from a file.
    gdPicturePDF.SetSignatureCertificateFromP12("C:\temp\certificate.pfx", "nutrient")
    ' Add additional signature information.
    gdPicturePDF.SetSignatureInfo("John Smith", "Confidential", "Vienna (Austria)", "john.smith@nutrient.io")
    ' Save the output to a file.
    gdPicturePDF.ApplySignature("C:\temp\output.pdf", PdfSignatureMode.PdfSignatureModeAdobePPKMS, False)
End Using

```

#### Used methods

- [`ApplySignature`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~ApplySignature.html)

- [`LoadFromFile`](/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~LoadFromFile.html)

- [`SetSignatureCertificateFromP12`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~SetSignatureCertificateFromP12.html)

- [`SetSignatureInfo`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~SetSignatureInfo.html)

#### Related topics

- [Load a file](/guides/dotnet/load-a-file.md)

### Additional certificate settings

The list below contains methods that provide additional settings when using a certificate. Use them after the [`SetSignatureCertificateFromP12` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~SetSignatureCertificateFromP12.html) and before the [`ApplySignature` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~ApplySignature.html):

- The [`SetSignatureValidationMark` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~SetSignatureValidationMark.html) adds the validation icon inside the certificate with the [`SetSignatureValidationMark` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~SetSignatureValidationMark.html).

- The [`SetSignatureCertificationLevel` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~SetSignatureCertificationLevel.html) specifies the certificate’s certification level. It uses the [`PdfSignatureCertificationLevel` enumeration](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.PdfSignatureCertificationLevel.html) as its parameter. This parameter enables you to define the access permissions granted by the certificate.

- The [`SetSignatureHash` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~SetSignatureHash.html) sets the hash algorithm used in the signing. It uses the [`PdfSignatureHash` enumeration](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~SetSignatureHash.html) as its parameter.

- The [`SetSignatureTimestampInfo` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~SetSignatureTimestampInfo.html) sets the timestamp information.










## Getting the certificate properties

To get the properties of a certificate inside a PDF document, follow these steps:

1. Use the [`GetSignatureCount` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~GetSignatureCount.html) to get the total number of signatures.

2. Loop through all signatures and use the [`GetSignatureProperties` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~GetSignatureProperties.html). It requires the signature index and the following list of output reference parameters:
   - `SignatureName` — The name of the person or authority signing the document.
   - `SignatureReason` — The reason for signing the document.
   - `SignatureLocation` — The physical location where the signing took place.
   - `SignatureContactInfo` — The contact information of the signer.
   - `SignatureDate` — The time of signing as a string.
   - `StampLeft` — The horizontal coordinate of the signature’s closest point to the currently defined origin. The returned value is expressed in the units specified by the [`SetMeasurementUnit` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~SetMeasurementUnit.html).
   - `StampTop` — The vertical coordinate of the signature’s closest point to the currently defined origin. The returned value is expressed in the units specified by the [`SetMeasurementUnit` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~SetMeasurementUnit.html).
   - `StampWidth` — The width of the signature’s bounding box, expressed in the current units defined by the [`SetMeasurementUnit` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~SetMeasurementUnit.html).
   - `StampHeight` — The height of the signature’s bounding box, expressed in the current units defined by the [`SetMeasurementUnit` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~SetMeasurementUnit.html).
   - `StampPage` — The page number where the signature is.
   - `DocumentValid` — A Boolean value that specifies whether the document has been altered or corrupted since it was signed.
   - `CertificateValid` — A Boolean value that specifies whether the certificate used is verified.
   - `CertificateFriendlyName` — The name of the certificate’s owner.
   - `CertificateIssuer` — The name of the authority that issued the certificate.
   - `CertificateNotBefore` — The earliest time and date when the used certificate was valid.
   - `CertificateNotAfter` — The time and date after which the used certificate is no longer valid.
   - `CertificateSubject` — The entity the used certificate belongs to (a person or an organization).
   - `CertificateVersion` — The version of the used certificate.
   - `SigningTime` — The date and time when the document was signed. Only use this value when the time of signing isn’t available in the signature.
   - `SignatureLevel` — A member of the [`PdfSignatureCertificationLevel` enumeration](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.PdfSignatureCertificationLevel.html) that represents the level of the signature certification.

If you have only one certificate in a PDF document, you can skip the `GetSignatureCount` method and use the `GetSignatureProperties` method with the signature index set to `0` as its parameter.

To list the properties of all certificates in a PDF document, use the following code:

### C#

```csharp

using GdPicturePDF gdPicturePDF = new GdPicturePDF();
gdPicturePDF.LoadFromFile(@"C:\temp\source.pdf");
// Initiate all reference parameters.
string SignatureName = "", SignatureReason = "", SignatureLocation = "", SignatureContactInfo = "";
string SignatureDate = "", CertificateFriendlyName = "", CertificateIssuer = "", CertificateSubject = "";
float StampLeft = 0, StampTop = 0, StampWidth = 0, StampHeight = 0;
int StampPage = 0, CertificateVersion = 0;
bool DocumentValid = false, CertificateValid = false;
DateTime CertificateNotBefore = new DateTime();
DateTime CertificateNotAfter = new DateTime();
DateTime SigningTime = new DateTime();
PdfSignatureCertificationLevel SignatureLevel = PdfSignatureCertificationLevel.NotCertified;

// Get the total amount of certificates.
int signatureCount = gdPicturePDF.GetSignatureCount();
for (int i = 0; i <= signatureCount - 1; i++)
{
    // Get the properties of a certificate.
    gdPicturePDF.GetSignatureProperties(i,
        ref SignatureName,
        ref SignatureReason,
        ref SignatureLocation,
        ref SignatureContactInfo,
        ref SignatureDate,
        ref StampLeft,
        ref StampTop,
        ref StampWidth,
        ref StampHeight,
        ref StampPage,
        ref DocumentValid,
        ref CertificateValid,
        ref CertificateFriendlyName,
        ref CertificateIssuer,
        ref CertificateNotBefore,
        ref CertificateNotAfter,
        ref CertificateSubject,
        ref CertificateVersion,
        ref SigningTime,
        ref SignatureLevel);
    // Write the certificate name, reason, and signing date to the console.
    Console.WriteLine("Signature nr {0}:\n- Name: {1}\n- Reason: {2}\n- Date Signed: {3}",
       i, SignatureName, SignatureReason, SignatureDate);
}

```

### VB.NET

```vb

Using gdPicturePDF As GdPicturePDF = New GdPicturePDF()
    gdPicturePDF.LoadFromFile("C:\temp\source.pdf")
    ' Initiate all reference parameters.
    Dim SignatureName = "", SignatureReason = "", SignatureLocation = "", SignatureContactInfo = ""
    Dim SignatureDate = "", CertificateFriendlyName = "", CertificateIssuer = "", CertificateSubject = ""
    Dim StampLeft As Single = 0, StampTop As Single = 0, StampWidth As Single = 0, StampHeight As Single = 0
    Dim StampPage = 0, CertificateVersion = 0
    Dim DocumentValid = False, CertificateValid = False
    Dim CertificateNotBefore As Date = New DateTime()
    Dim CertificateNotAfter As Date = New DateTime()
    Dim SigningTime As Date = New DateTime()
    Dim SignatureLevel As PdfSignatureCertificationLevel = PdfSignatureCertificationLevel.NotCertified

    ' Get the total amount of certificates.
    Dim signatureCount As Integer = gdPicturePDF.GetSignatureCount()
    For i = 0 To signatureCount - 1
        ' Get the properties of a certificate.
        gdPicturePDF.GetSignatureProperties(i,
            SignatureName,
            SignatureReason,
            SignatureLocation,
            SignatureContactInfo,
            SignatureDate,
            StampLeft,
            StampTop,
            StampWidth,
            StampHeight,
            StampPage,
            DocumentValid,
            CertificateValid,
            CertificateFriendlyName,
            CertificateIssuer,
            CertificateNotBefore,
            CertificateNotAfter,
            CertificateSubject,
            CertificateVersion,
            SigningTime,
            SignatureLevel)
        ' Write the certificate name, reason, and signing date to the console.
        Console.WriteLine("Signature nr {0}:" & vbLf & "- Name: {1}" & vbLf & "- Reason: {2}" & vbLf & "- Date Signed: {3}",
            i, SignatureName, SignatureReason, SignatureDate)
    Next
End Using

```

#### Used methods

- [`GetSignatureCount`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~GetSignatureCount.html)

- [`GetSignatureProperties`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~GetSignatureProperties.html)

- [`LoadFromFile`](/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~LoadFromFile.html)

#### Related topics

- [Load a file](/guides/dotnet/load-a-file.md)






## Removing a certificate from a PDF document

To remove a certificate, use the [`RemoveSignature` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~RemoveSignature.html). It requires only the signature index as its parameter. Use the [`GetSignatureCount` method](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~GetSignatureCount.html) to get the total number of signatures.

If you have only one certificate in a PDF document, you can skip the `GetSignatureCount` method and use the `RemoveSignature` method with the signature index set to `0` as its parameter.

To delete all certificates, use the following code:

### C#

```csharp

using GdPicturePDF gdPicturePDF = new GdPicturePDF();
gdPicturePDF.LoadFromFile(@"C:\temp\source.pdf");
// Get the total amount of certificates.
int signatureCount = gdPicturePDF.GetSignatureCount();
for (int i = 0; i <= signatureCount - 1; i++)
{
    // Remove the certificate.
    gdPicturePDF.RemoveSignature(0);
}
gdPicturePDF.SaveToFile(@"C:\temp\output.pdf");

```

### VB.NET

```vb

Using gdPicturePDF As GdPicturePDF = New GdPicturePDF()
    gdPicturePDF.LoadFromFile("C:\temp\source.pdf")
    ' Get the total amount of certificates.
    Dim signatureCount As Integer = gdPicturePDF.GetSignatureCount()
    For i = 0 To signatureCount - 1
        ' Remove the certificate.
        gdPicturePDF.RemoveSignature(0)
    Next

    gdPicturePDF.SaveToFile("C:\temp\output.pdf")
End Using

```

#### Used methods

- [`GetSignatureCount`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~GetSignatureCount.html)

- [`LoadFromFile`](/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~LoadFromFile.html)

- [`RemoveSignature`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~RemoveSignature.html)

- [`SaveToFile`](/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~SaveToFile.html)

#### Related topics

- [Load a file](/guides/dotnet/load-a-file.md)

- [Save a file](/guides/dotnet/save-a-file.md)




## Certifying a PDF document from other sources

To add a certificate from sources other than a PFX file, such as a smart card or a Windows certificate store, use the following methods:

- [`SetSignatureCertificateFromSmartCard`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~SetSignatureCertificateFromSmartCard.html)

- [`SetSignatureCertificateFromSmartCardBySerialNumber`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~SetSignatureCertificateFromSmartCardBySerialNumber.html)

- [`SetSignatureCertificateFromStore`](https://www.nutrient.io/api/gdpicture/GdPicture.NET.14.API~GdPicture14.GdPicturePDF~SetSignatureCertificateFromStore.html)
---

## Related pages

- [Create a self-signed certificate with PADES extensions](/guides/dotnet/signatures/digital-signatures/sign-a-pdf-ua-document.md)
- [Add a digital signature to a PDF in C#](/guides/dotnet/signatures/digital-signatures/add-a-digital-signature.md)
- [Create a self-signed certificate with PADES extensions](/guides/dotnet/signatures/digital-signatures/sign-a-docx-as-pdf-ua.md)

