Sign document with XML Advanced Electronic Signature
Sign document with XML Advanced Electronic Signature
Leave feedback
On this page
Note
XML Advanced Electronic Signature feature is supported only for Spreadsheet documents
GroupDocs.Signature provides DigitalSignOptions class to specify different amount of settings for Digital signature. One of these settings is the XAdES type, set with setXAdESType to a value of the XAdESType class
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.
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.
Signaturesignature=newSignature("sample.xlsx");try{DigitalSignOptionsoptions=newDigitalSignOptions("certificate.pfx");// set XAdES type
options.setXAdESType(XAdESType.XAdES);// certificate password
options.setPassword("1234567890");// digital certificate details
options.setReason("Sign");options.setContact("JohnSmith");options.setLocation("Office1");SignResultsignResult=signature.sign(outputFilePath,options);System.out.println("Source document was signed successfully with "+signResult.getSucceeded().size()+" signature(s). File saved at "+outputFilePath+".");}finally{signature.dispose();}
More resources
GitHub Examples
You may easily run the code above and see the feature in action in our GitHub examples: