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, 7Z, LZ, GZIP 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 signatures as the list of the DocumentResultSignature instances.

Here are the steps to sign the archive files like ZIP, TAR, 7z, LZ, GZIP 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.

/// <summary>
/// Support Succeeded and Failed list as result of processing archives
/// </summary>
using (var signature = new Signature("sample.zip"))
{
    // create sign options
    var options = new TextSignOptions("signed!")
    {
        // set signature position
        Left = 100,
        Top = 100
    };
    // sign archive to new zip file
    SignResult result = signature.Sign("output.zip", options);
    // analyze signed documents
    foreach (DocumentResultSignature document in result.Succeeded)
    {
        Console.WriteLine($"Document {document.FileName}. Processed: {document.ProcessingTime}, mls");
    }
    if (result.Failed.Count > 0)
    {
        Console.WriteLine("\nList of failed documents:");
        foreach (DocumentResultSignature document in result.Failed)
        {
            Console.WriteLine($"Document {document.FileName}. Processed: {document.ProcessingTime}, mls");
        }
    }
}

Sign single-file archive documents

LZ and GZIP formats compress individual files into single-file archives, optimizing them for storage and transmission.

Note
The name of the archive file should match the name of the file contained.

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

using (Signature signature = new Signature("sample.pdf.gz"))
{
    // create sign options
    TextSignOptions options = new TextSignOptions("signed!")
    {
        // set signature position
        Left = 100,
        Top = 100
    };
    // sign archive to new zip file
    SignResult result = signature.Sign("output.pdf.gz", options);
    // analyze signed documents
    foreach (DocumentResultSignature document in result.Succeeded)
    {
        Console.WriteLine($"Document {document.FileName}. Processed: {document.ProcessingTime}, mls");
    }
}

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