How to convert archive files to HTML

Introduction

Archive file formats are related to files compression. There various archive formats: Mostly used in Windows: ZIP, RAR Mostly used in Linux (Unix): TAR, BZIP2 (BZ2), GZIP

ZIP archives can be opened with Windows explorer, RAR, TAR, BZIP2, GZIP formats can be opened with WinRar,

Archive in windows explorer

If you convert archive files to HTML, you can choose beetween multiple and single pages conversion.

How to convert archive files to HTML

Convert archive files to multiple pages HTML

If property RenderSinglePage is set to false (by default), you can set ItemsPerPage property - the number of items per page (default is 16), it is for rendering to HTML only. To convert archive files to multiple pages HTML with GroupDocs.Viewer for .NET use following code:

using (Viewer viewer = new Viewer("sample.zip"))
{
       HtmlViewOptions options = HtmlViewOptions.ForEmbeddedResources("output_page_{0}.html");
       options.ArchiveOptions.ItemsPerPage = 10;

       viewer.View(options);
}

The following screenshot shows the output HTML file opened in a browser.

Multiple pages HTML converted archive

Convert archive files to single HTML

To convert archive files to single page HTML with GroupDocs.Viewer for .NET use following code:

using (Viewer viewer = new Viewer("sample.zip"))
{
       HtmlViewOptions options = HtmlViewOptions.ForEmbeddedResources("output.html");
       options.RenderSinglePage = true;
       viewer.View(options);
}

The following screenshot shows the output HTML file opened in a browser.

Single page HTML converted zip

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 .NET library we provide simple but powerful free Apps. You are welcome to view Word, PDF, Excel, PowerPoint documents with free to use online GroupDocs Viewer App.