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,
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 Java use following code:
try (Viewer viewer = new Viewer("sample.zip")) {
HtmlViewOptions options = HtmlViewOptions.forEmbeddedResources("output_page_{0}.html");
options.getArchiveOptions().setItemsPerPage(10);
viewer.view(options);
}
The following screenshot shows the output HTML file opened in a browser.
Convert archive files to single HTML
To convert archive files to single page HTML with GroupDocs.Viewer for Java use following code:
try (Viewer viewer = new Viewer("sample.zip")) {
HtmlViewOptions options = HtmlViewOptions.forEmbeddedResources("output.html");
options.setRenderSinglePage(true);
viewer.view(options);
}
The following screenshot shows the output HTML file opened in a browser.
More resources
GitHub Examples
You may easily run the code above and see the feature in action in our GitHub examples:
- GroupDocs.Viewer for Java examples, plugins, and showcase
- Document Viewer for .NET App WebForms UI Modern Example
- Document Viewer for Java App Dropwizard UI Modern Example
- Document Viewer for Java Spring UI Example
- GroupDocs.Viewer for .NET samples, plugins and showcase
- Document Viewer for .NET MVC UI Example
Free Online App
Along with full-featured Java 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.