Signing archive documents in batch

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 →

GroupDocs.Signature supports signing archive files with formats like ZIP, TAR the same way as usual documents. The only difference in the SignResult of the Sign method will contain for archive files the lists of Succeeded and Failed of the Sign method will contain for archive files the lists of Succeeded signatures as the
list of the DocumentResultSignature instances.

Here are the steps to sign the archive files like ZIP, TAR with GroupDocs.Signature:

  • Create a new instance of Signature class and pass the source archive path or stream of the archive as a constructor parameter.
  • Instantiate the single SignOptions object or list of this class with the required options.
  • Call Sign method of  Signature class instance and pass SignOptions to it.
  • The passed signature options will be applied to the all documents within the archive.
  • Analyze response SignResult over the properties Succeeded and Failed signatures as the instances of the DocumentResultSignature

Sign archive document

This example shows how to sign archive document with few SignOptions.

    /**
     * <p>
     * Sign ZIP Documents with various signature options
     * </p>
     */
Signature signature = new Signature("sample.zip");
{
    // create sign options
    TextSignOptions options = new TextSignOptions("signed!");
    {
        // set signature position
        options.setLeft(100);
        options.setTop(100);
    };
    // sign archive to new zip file
    SignResult result = signature.sign("output.zip", options);
    int number = 1;
    // analyze signed documents
     for (BaseSignature o : result.getSucceeded())
    {
        DocumentResultSignature document = (DocumentResultSignature)o;
        System.out.print("Document #"+ number++ +": "+document.getFileName()+". Processed: "+document.getProcessingTime()+", mls");
    }
    if (result.getFailed().size() > 0)
    {
        System.out.print("\nList of failed documents:");
        number = 1;
        for (BaseSignature o : result.getFailed())
        {
            DocumentResultSignature document = (DocumentResultSignature)o;
            System.out.print("Document #"+number++ +": "+document.getFileName()+". Processed: "+document.getProcessingTime()+", mls");
        }
    }
}

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.