GroupDocs.Signature for .NET 25.1 Release Notes

The release of GroupDocs.Signature version 25.1 adds new enhancements.

Full list of changes in this release

KeyCategorySummary
SIGNATURENET-5392EnhancementEnhanced digital signature functionality with LTV (Long-Term Validation) support
SIGNATURENET-5367EnhancementImproved document loading with file type specification (Stream or File)

Major Enhancements

Enhanced digital signature functionality with LTV (Long-Term Validation) support

🌐 Digital signatures can now be applied to PDFs with LTV (Long-Term Validation) support. This ensures that the signature remains valid even if the signing certificate expires, by embedding the necessary data to validate the signature in the future. The feature can be enabled through the UseLtv option in the digital sign options.

string filePath = Constants.SAMPLE_PDF;
string certificatePath = Constants.CERTIFICATE_PFX;
string outputFilePath = "signed.pdf";

using (Signature signature = new Signature(filePath))
{
    // initialize digital option with certificate file path
    DigitalSignOptions options = new DigitalSignOptions(certificatePath)
    {
        // certifiate password
        Password = "1234567890",
        // digital certificate details
        Reason = "Sign",
        Contact = "JohnSmith",
        Location = "Office1",
        AllPages = true,
        Width = 80,
        Height = 60,
        VerticalAlignment = VerticalAlignment.Bottom,
        HorizontalAlignment = HorizontalAlignment.Right,
        Margin = new Padding() {Bottom = 10, Right = 10},
        
        // Enable Long-Term Validation (LTV) to ensure signature validity over time
        UseLtv = true
    };
    signature.Sign(outputFilePath, options);
}

The following image shows the signature information from AdobeAcrobat: Signature with LTV option

Improved document loading with file type specification (Stream or File)

🌐 When loading a document via a file path or FileStream, GroupDocs.Signature checks the file extension to determine the file type, which can take some time. with the new feature, you can specify the file type directly in LoadOptions, and GroupDocs.Signature will skip the detection process and use the specified type right away.

// The path to the documents directory.
string filePath = Constants.SAMPLE_PDF;
string fileName = Path.GetFileName(filePath);
string outputFilePath = Path.Combine(Constants.OutputPath, "LoadWithFileType", fileName);

using (Stream stream = File.OpenRead(filePath))
{
    LoadOptions loadOptions = new LoadOptions(FileType.PDF);
    using (Signature signature = new Signature(stream, loadOptions))
    {
        QrCodeSignOptions options = new QrCodeSignOptions("JohnSmith")
        {
            EncodeType = QrCodeTypes.QR,
            Left = 100,
            Top = 100
        };
        // sign document to file
        signature.Sign(outputFilePath, options);
    }
}
Console.WriteLine("\nSource document signed successfully.\nFile saved at " + outputFilePath);