Sign document with analysis of the Sign process result
Leave feedback
On this page
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 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()
{
using (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)
Console.WriteLine($"Sign-process was executed for {signResult.ProcessingTime} mls");
Console.WriteLine($"Input document size {signResult.SourceDocumentSize} bytes");
Console.WriteLine($"Output document size {signResult.DestinDocumentSize} bytes");
Console.WriteLine($"Total processed signatures {signResult.TotalSignatures}");
if (signResult.Failed.Count == 0)
{
Console.WriteLine("\nAll signatures were successfully created!");
}
else
{
Console.WriteLine($"Successfully created signatures : {signResult.Succeeded.Count}");
Helper.WriteError($"Failed signatures : {signResult.Failed.Count}");
}
Console.WriteLine("\nList of newly created signatures:");
int number = 1;
foreach (BaseSignature temp in signResult.Succeeded)
{
Console.WriteLine($"Signature #{number++}: Type: {temp.SignatureType} Id:{temp.SignatureId}");
}
}
}
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 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.
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.