---
title: "Add a document timestamp to a PDF in C# | Nutrient .NET SDK"
canonical_url: "https://www.nutrient.io/guides/dotnet/signatures/digital-signatures/add-document-timestamp-to-pdf/"
md_url: "https://www.nutrient.io/guides/dotnet/signatures/digital-signatures/add-document-timestamp-to-pdf.md"
last_updated: "2026-09-22T00:00:00.000Z"
description: "Learn how to add an RFC 3161 document timestamp to a PDF using Nutrient .NET SDK."
---

# Add a document timestamp to a PDF in C#

A document timestamp proves that a PDF existed in a specific state at a specific time. It protects the current document bytes, including signatures and validation material already present in the file.

Use document timestamps when archival or compliance workflows require independent timestamp evidence for the whole PDF.

This guide shows how to:

- Load a PDF document

- Configure a timestamp authority (TSA)

- Append a document timestamp to the PDF

This sample contacts an RFC 3161 timestamp authority. Replace the sample timestamp URL with the TSA endpoint approved for your environment.

## Prepare the project

Register the SDK license before running timestamp operations. For setup details, refer to the [getting started with.NET SDK](https://www.nutrient.io/sdk/dotnet/getting-started.md) guide.

```csharp

using System;
using GdPicture14;

void CheckStatus(GdPictureStatus status, string operation)
{
    if (status!= GdPictureStatus.OK)
    {
        throw new InvalidOperationException($"{operation} failed. Status: {status}");
    }
}

LicenseManager license = new LicenseManager();
license.RegisterKEY(""); // Set your license key

```

## Load the PDF document

Create a `GdPicturePDF` instance and load the source file:

```csharp

using GdPicturePDF pdf = new GdPicturePDF();

CheckStatus(pdf.LoadFromFile(@"input.pdf", false), "LoadFromFile");

```

## Configure the timestamp authority

Set the timestamp server URL and credentials. Leave the username and password empty for a public TSA that doesn't require authentication.

```csharp

CheckStatus(pdf.SetSignatureTimestampInfo("http://timestamp.digicert.com", "", ""), "SetSignatureTimestampInfo");

```

`SetSignatureTimestampInfo` stores the TSA configuration used by `ApplyDocumentTimestamp`.

## Apply the document timestamp

Append the timestamp as an incremental update:

```csharp

CheckStatus(pdf.ApplyDocumentTimestamp(@"timestamped.pdf"), "ApplyDocumentTimestamp");

```

The output PDF contains a document timestamp signature that covers the current document state.

## Error handling

Check the result of `ApplyDocumentTimestamp`. `InvalidParameter` indicates missing timestamp configuration. Network, TSA, or response-validation failures return a status that identifies the failed operation.

## Conclusion

This workflow loads a PDF, configures a TSA, and writes a timestamped PDF for archival validation workflows.
---

## Related pages

- [Add a digital signature to a PDF in C#](/guides/dotnet/signatures/digital-signatures/add-a-digital-signature.md)
- [Add LTV information to PDF signatures in C#](/guides/dotnet/signatures/digital-signatures/add-ltv-information-to-pdf-signatures.md)
- [Sign PDF documents with a certificate in C#](/guides/dotnet/signatures/digital-signatures/certify-a-document.md)
- [Create PAdES B-LT and B-LTA signatures in C#](/guides/dotnet/signatures/digital-signatures/create-pades-b-lt-and-b-lta-signatures.md)
- [Deferred two-phase PDF signing in C#](/guides/dotnet/signatures/digital-signatures/deferred-two-phase-pdf-signing.md)
- [Create a self-signed certificate with PADES extensions](/guides/dotnet/signatures/digital-signatures/sign-a-docx-as-pdf-ua.md)
- [Create a self-signed certificate with PADES extensions](/guides/dotnet/signatures/digital-signatures/sign-a-pdf-ua-document.md)
- [Sign a PDF with an ECDSA certificate in C#](/guides/dotnet/signatures/digital-signatures/sign-pdf-with-ecdsa-certificate.md)
- [Sign a PDF with PKCS#11 in C#](/guides/dotnet/signatures/digital-signatures/sign-pdf-with-pkcs11.md)

