Sign document with analysis of the Sign process result

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Signature MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-signature -- dnx GroupDocs.Signature.Mcp --yes
Folders, licensing and more →

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.

Sign document with result analysis

This example shows how to analyze 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());
        }
    }
}

More resources

GitHub Examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free Online App

Along with full-featured Java 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.