Load compression document with options

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, Bz2, Cab, Cpio, Gz, Gzip, Lz, Lzma, Rar, Tar, Xz, Z, Zip
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:

With v24.10 and later:

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);
}

Before v24.10:

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

Func<LoadOptions> getLoadOptions = () => 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:

With v24.10 and later:

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);
}

Before v24.10:

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

Func<LoadOptions> getLoadOptions = () => 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:

With v24.10 and later:

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);
}

Before v24.10:

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

Func<LoadOptions> getLoadOptions = () => 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:

With v24.10 and later:

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);
}

Before v24.10:

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

Func<LoadOptions> getLoadOptions = () => 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:

With v24.10 and later:

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);
}

Before v24.10:

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

Func<LoadOptions> getLoadOptions = () => 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);
}
Close
Loading

Analyzing your prompt, please hold on...

An error occurred while retrieving the results. Please refresh the page and try again.