Sign document with XAdES Digital signature

Note
This feature is supported only for Spreadsheet document types

GroupDocs.Signature provides DigitalSignOptions class to specify different amount of settings for Digital signature, including the XAdES type set with setXAdESType to a value of the XAdESType class. This setting specifies the implementation of XAdES format for Spreadsheet documents only (for now).

Here are the steps to add XAdES type signature into document 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.
  • Call setXAdESType with the 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.

This example shows how to add Digital signature to document. See SignResult

Signature signature = new Signature("sample.xlsx");
try
{
    DigitalSignOptions options = new DigitalSignOptions("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");

    SignResult signResult = signature.sign(outputFilePath, options);
}
finally
{
    signature.dispose();
}

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 Java 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.

Close
Loading

Analyzing your prompt, please hold on...

An error occurred while retrieving the results. Please refresh the page and try again.