Sign document with XML Advanced Electronic Signature

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Signature MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-signature -- dnx GroupDocs.Signature.Mcp --yes
Folders, licensing and more →
Note
XML Advanced Electronic Signature feature is now supported under .Net Framework only for Spreadsheet documents

GroupDocs.Signature provides DigitalSignOptions class to specify different amount of settings for Digital signature. One of these properties is the field of enumeration type XAdESType

Here are the steps to add XML Advanced Electronic Signature with GroupDocs.Signature:

  • Create new instance of Signature class and pass source document path as a constructor parameter.
  • Instantiate the DigitalSignOptions object with required certificate and its password.
  • Set property XAdESType to enumeration value XAdESType.XAdES.
  • Call Sign method of Signature class instance and pass DigitalSignOptions to it.
  • Analyze SignResult result to check newly created signatures if needed.

Sign Spreadsheet document with XML Advanced Electronic Signature

This example shows how to add Digital signature to document.

using (Signature signature = new Signature("sample.xlsx"))
{
    DigitalSignOptions options = new DigitalSignOptions("certificate.pfx")
    {
        // set XAdES type
        XAdESType = XAdESType.XAdES,
        // certificate password
        Password = "1234567890",
        // digital certificate details
        Reason = "Sign",
        Contact = "JohnSmith",
        Location = "Office1"
    };
    SignResult signResult = signature.Sign(outputFilePath, options);
    Console.WriteLine($"\nSource document was signed successfully with {signResult.Succeeded.Count} signature(s).\nFile saved at {outputFilePath}.");
}

More resources

GitHub Examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free Online Apps

Along with the full-featured .NET library, we provide simple but powerful free online apps.

To sign PDF, Word, Excel, PowerPoint, and other documents you can use the online apps from the GroupDocs.Signature App Product Family.