Timestamp Plugin

Overview

The Aspose.Pdf.LowCode.Timestamp plugin adds a timestamped signature to a PDF document. Configure the operation with TimestampOptions, provide a PFX certificate and timestamp server URL, add input and output data sources, and call Process.

Add a timestamp to a PDF document

// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void TimestampPdfWithPlugin()
{
    // The path to the documents directory
    var dataDir = RunExamples.GetDataDir_AsposePdf_SecuritySignatures();

    // Create timestamp options
    var options = new Aspose.Pdf.LowCode.TimestampOptions(dataDir + "37992.pfx", "111111")
    {
        ServerUrl = "http://timestamp.digicert.com",
        BasicAuthCredentials = string.Empty,
        DigestHashAlgorithm = Aspose.Pdf.DigestHashAlgorithm.Sha256
    };
    options.AddInput(new Aspose.Pdf.LowCode.FileDataSource(dataDir + "37992.pdf"));
    options.AddOutput(new Aspose.Pdf.LowCode.FileDataSource(dataDir + "TimestampPdfWithPlugin_out.pdf"));

    // Add timestamped signature
    using (var plugin = new Aspose.Pdf.LowCode.Timestamp())
    {
        var result = plugin.Process(options);

        // Get the path of the timestamped PDF document
        var outputPath = result.ResultCollection[0].ToFile();
    }
}

Options

TimestampOptions.ServerUrl is required. You can also set BasicAuthCredentials, DigestHashAlgorithm, PageNumber, signature metadata, visibility, and rectangle.