The Compressed files (e.g .ZIP or TAR) use file compression in order to save the disk space. Also, the compressed archive formats can be used to compress multiple files into a single archive. This post demonstrates the usage of the GroupDocs.Viewer API to render the list of files or folders from an archive file.
Rendering the List of a Folder from the Archive
The GetPages method of both ViewerImageHandler and ViewerHtmlHandler renders the items from the root of archives.
The following code snippet shows that how simple is to render the list of items from the root of an archive:View the code on Gist.
The output of the above code snippet looks as follows:
Rendering Specified Folder into Image, HTML or PDF
To render a specified folder from an archive into image, html or PDF, all ImageOptions, HtmlOptions and PdfOptions classes have the ArchiveOptions.FolderName property which is used like:
ArchiveOptions.FolderName = "FirstLevelFolder";
When you need to render the list of folders contained in a certain folder inside the archive, set the value using ‘/’ path delimiter character like:
ArchiveOptions.FolderName = "FirstLevelFolder/SecondLevelFolder";
The following example shows the rendering of a list of items from a folder “SecondLevelFolder” which is contained inside the “FirstLevelFolder” of the archive:View the code on Gist.
If the rendering into PDF file is required, you can write the code as follows:View the code on Gist.
The complete ready to run code sample is available on GitHub.