Load compression document with options

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.Conversion 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-conversion -- dnx GroupDocs.Conversion.Mcp --yes
Folders, licensing and more →

GroupDocs.Conversion provides CompressionLoadOptions to control how source compression files are processed. Compression files include formats like ZIP, 7Z, RAR, TAR, GZIP, and other archive formats.

The following options are available:

OptionDescription
FormatThe document type is auto-detected during loading, but you can explicitly specify the source format. Available options include: SevenZ, Aar, Alz, Bz2, Cab, Cpio, Gz, Gzip, Iso, Lha, Lz, Lz4, Lzma, Rar, Tar, Uue, Wim, Xar, Xz, Z, Zip, Zst
PasswordSet password to load protected archive
ConvertOwnedThe owned documents will be converted (read-only, set to true by default)
ConvertOwnerThe owner will not be converted (read-only, set to false by default)
DepthControls recursion depth for nested documents. Default value is 3.

Load ZIP archive

The following code snippet shows how to load a ZIP archive with explicit format specification:

using GroupDocs.Conversion;
using GroupDocs.Conversion.FileTypes;
using GroupDocs.Conversion.Options.Convert;
using GroupDocs.Conversion.Options.Load;

Func<LoadContext, LoadOptions> getLoadOptions = loadContext => new CompressionLoadOptions
{
    Format = CompressionFileType.Zip
};

using (Converter converter = new Converter("documents-archive.zip", getLoadOptions))
{
    PdfConvertOptions options = new PdfConvertOptions();
    converter.Convert("documents-archive.pdf", options);
}

Load RAR archive

The following code snippet shows how to load a RAR archive:

using GroupDocs.Conversion;
using GroupDocs.Conversion.FileTypes;
using GroupDocs.Conversion.Options.Convert;
using GroupDocs.Conversion.Options.Load;

Func<LoadContext, LoadOptions> getLoadOptions = loadContext => new CompressionLoadOptions
{
    Format = CompressionFileType.Rar
};

using (Converter converter = new Converter("backup-files.rar", getLoadOptions))
{
    PdfConvertOptions options = new PdfConvertOptions();
    converter.Convert("backup-files.pdf", options);
}

Load 7Z archive

The following code snippet shows how to load a 7Z archive:

using GroupDocs.Conversion;
using GroupDocs.Conversion.FileTypes;
using GroupDocs.Conversion.Options.Convert;
using GroupDocs.Conversion.Options.Load;

Func<LoadContext, LoadOptions> getLoadOptions = loadContext => new CompressionLoadOptions
{
    Format = CompressionFileType.SevenZ
};

using (Converter converter = new Converter("project-files.7z", getLoadOptions))
{
    PdfConvertOptions options = new PdfConvertOptions();
    converter.Convert("project-files.pdf", options);
}

Convert between compression formats

The following code snippet shows how to convert from ZIP to 7Z format:

using GroupDocs.Conversion;
using GroupDocs.Conversion.FileTypes;
using GroupDocs.Conversion.Options.Convert;
using GroupDocs.Conversion.Options.Load;

Func<LoadContext, LoadOptions> getLoadOptions = loadContext => new CompressionLoadOptions
{
    Format = CompressionFileType.Zip
};

using (Converter converter = new Converter("source-archive.zip", getLoadOptions))
{
    CompressionConvertOptions options = new CompressionConvertOptions
    {
        Format = CompressionFileType.SevenZ
    };
    converter.Convert("source-archive.7z", options);
}

Load password-protected archive

The following code snippet shows how to load a password-protected ZIP archive:

using GroupDocs.Conversion;
using GroupDocs.Conversion.FileTypes;
using GroupDocs.Conversion.Options.Convert;
using GroupDocs.Conversion.Options.Load;

Func<LoadContext, LoadOptions> getLoadOptions = loadContext => new CompressionLoadOptions
{
    Format = CompressionFileType.Zip,
    Password = "archive-password"
};

using (Converter converter = new Converter("protected-archive.zip", getLoadOptions))
{
    PdfConvertOptions options = new PdfConvertOptions();
    converter.Convert("protected-archive.pdf", options);
}