Sign document with analysis of the Sign process result
Leave feedback
com.groupdocs.signature provides the each method result as the implementation of the IResult interface which contains the process metrics.
Here are the steps to analyze the process result with com.groupdocs.signature:
- Create a new instance of Signature class and pass the source document path as a constructor parameter.
- Instantiate the SignOptions object with the required options and set the ZOrder property.
- Call sign method of Signature class instance and pass SignOptions to it.
- Analyze SignResult response of the sign method.
This example shows how to analize sign process result.
public static void Run()
{
Signature signature = new Signature("sample.pdf");
{
// create QRCode option with predefined QRCode text
QrCodeSignOptions options = new QrCodeSignOptions("JohnSmith");
// sign document to file
SignResult signResult = signature.sign("output.pdf", options);
// analyze SignResult (IResult properties)
System.out.print("Sign-process was executed for "+signResult.getProcessingTime()+" mls");
System.out.print("Input document size "+signResult.getSourceDocumentSize()+" bytes");
System.out.print("Output document size "+signResult.getDestinDocumentSize()+" bytes");
System.out.print("Total processed signatures "+signResult.getTotalSignatures());
if (signResult.getFailed().size() == 0)
{
System.out.print("\nAll signatures were successfully created!");
}
else
{
System.out.print("Successfully created signatures : "+signResult.getSucceeded().size());
System.out.print("Failed signatures : "+signResult.getFailed().size());
}
System.out.print("\nList of newly created signatures:");
int number = 1;
for (BaseSignature temp : signResult.getSucceeded())
{
System.out.print("Signature #"+ +number++ +": Type: "+temp.getSignatureType()+" Id:"+temp.getSignatureId()+", Location: "+temp.getLeft()+"x"+temp.getTop()+". Size: "+temp.getWidth()+"x"+temp.getHeight());
}
}
}
You may easily run the code above and see the feature in action in our GitHub examples:
- GroupDocs.Signature for .NET examples, plugins, and showcase
- GroupDocs.Signature for Java examples, plugins, and showcase
- Document Signature for .NET MVC UI Example
- Document Signature for .NET App WebForms UI Example
- Document Signature for Java App Dropwizard UI Example
- Document Signature for Java Spring UI Example
Along with full-featured .NET library we provide simple, but powerful free Apps.
You are welcome to eSign PDF, Word, Excel, PowerPoint documents with free to use online GroupDocs Signature App.
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.