Skip to content

Instantly share code, notes, and snippets.

@GroupDocsGists
Last active March 29, 2019 07:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GroupDocsGists/055b16a3478b58ad3d823fe6e9873da4 to your computer and use it in GitHub Desktop.
Save GroupDocsGists/055b16a3478b58ad3d823fe6e9873da4 to your computer and use it in GitHub Desktop.
// For complete examples and data files, please go to https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-.NET
// Setup GroupDocs.Viewer config
ViewerConfig config = new ViewerConfig();
config.StoragePath = @"C:\storage";
// Create HTML or image handler
ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);
string guid = "archive.zip";
// Get archive document info
ArchiveDocumentInfoContainer documentInfoContainer = htmlHandler.GetDocumentInfo(guid) as ArchiveDocumentInfoContainer;
foreach (string folderName in documentInfoContainer.Folders)
Console.WriteLine("Folder name: {0}", folderName);
// For complete examples and data files, please go to https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-.NET
// Setup GroupDocs.Viewer config
ViewerConfig config = new ViewerConfig();
config.StoragePath = @"C:\storage";
// Create HTML or image handler
ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);
string guid = "archive.zip";
// set option to retrieve list of folders from certain folder.
HtmlOptions options = new HtmlOptions();
options.ArchiveOptions.FolderName = "FirstLevelFolder/SecondLevelFolder";
// Get archive document info
ArchiveDocumentInfoContainer documentInfoContainer = htmlHandler.GetDocumentInfo(guid, options) as ArchiveDocumentInfoContainer;
foreach (string folderName in documentInfoContainer.Folders)
Console.WriteLine("Folder name: {0}", folderName);
// For complete examples and data files, please go to https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-.NET
// Setup GroupDocs.Viewer config
ViewerConfig viewerConfig = new ViewerConfig();
viewerConfig.StoragePath = @"C:\storage";
// Create image handler
ViewerImageHandler imageHandler = new ViewerImageHandler(viewerConfig);
// Create PDF file security
string ownerPassword = "owner password";
string userPassword = "user password";
PdfFilePermissions denyPrinting = PdfFilePermissions.All ^ PdfFilePermissions.Printing;
PdfFileSecurity pdfFileSecurity = new PdfFileSecurity(ownerPassword, userPassword, denyPrinting);
// Create options
PdfFileOptions pdfFileOptions = new PdfFileOptions();
pdfFileOptions.PdfFileSecurity = pdfFileSecurity;
string guid = "document.doc";
FileContainer fileContainer = imageHandler.GetPdfFile(guid, pdfFileOptions);
// For complete examples and data files, please go to https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-.NET
// Setup GroupDocs.Viewer config
ViewerConfig config = new ViewerConfig();
config.StoragePath = @"C:\storage";
// Create image handler or use ViewerHtmlHandler to render into HTML
ViewerImageHandler imageHandler = new ViewerImageHandler(config);
string guid = "sample.zip";
// Create image options with specified folder name (use HtmlOptions to render into HTML)
ImageOptions options = new ImageOptions();
options.ArchiveOptions.FolderName = "FirstLevelFolder/SecondLevelFolder";
// Render document into image
List<PageImage> pages = imageHandler.GetPages(guid, options);
foreach (PageImage page in pages)
{
// use page.Stream to work with rendering result
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment