How to convert and view archive files

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

How to convert archive files

Convert archive files to multiple pages HTML

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

       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

Convert archive files to JPG

To convert archive files to JPG with GroupDocs.Viewer for .NET use following code:

using (Viewer viewer = new Viewer("sample.zip"))
{
       JpgViewOptions options = new JpgViewOptions("output_page_{0}.jpg");
       viewer.View(options);
}

The following screenshot shows the output JPG file opened in a Windows Photo Viewer application.

JPEG converted archive

Convert archive files to PNG

To convert archive files to PNG with GroupDocs.Viewer for .NET use following code:

using (Viewer viewer = new Viewer("sample.zip"))
{
       PngViewOptions options = new PngViewOptions("output_page_{0}.png");
       viewer.View(options);
}

The following screenshot shows the output PNG file opened in a Windows Photo Viewer application.

PNG converted archive

Convert archive to PDF

To convert Roshal Archive files to PDF with GroupDocs.Viewer for .NET use following code:

using (Viewer viewer = new Viewer("sample.zip"))
{
       PdfViewOptions options = new PdfViewOptions("output.pdf");
       viewer.View(options);
}

The following screenshot shows the output PDF file opened in an Acrobat Reader.

PDF converted archive

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.