Sign document with XML Advanced Electronic Signature
Leave feedback
On this page
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.
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(Signaturesignature=newSignature("sample.xlsx")){DigitalSignOptionsoptions=newDigitalSignOptions("certificate.pfx"){// set XAdES typeXAdESType=XAdESType.XAdES,// certificate passwordPassword="1234567890",// digital certificate detailsReason="Sign",Contact="JohnSmith",Location="Office1"};SignResultsignResult=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: