Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// Setup GroupDocs.Viewer config
ViewerConfig config = new ViewerConfig();
config.setStoragePath("c:\\storage");
// Create image handler
ViewerImageHandler imageHandler = new ViewerImageHandler(config);
// Retrieve document information
String guid = "document.pdf";
PdfDocumentInfoContainer documentInfo = (PdfDocumentInfoContainer) imageHandler.getDocumentInfo(guid);
boolean printingAllowed = documentInfo.getPrintingAllowed();
// Setup GroupDocs.Viewer config
ViewerConfig config = new ViewerConfig();
config.setStoragePath("c:\\storage");
// Create HTML or image handler
ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);
String guid = "archive.zip";
// Get archive document info
ArchiveDocumentInfoContainer documentInfoContainer = (ArchiveDocumentInfoContainer) htmlHandler.getDocumentInfo(guid);
for (String folderName : documentInfoContainer.getFolders())
{
System.out.println("Folder name: " + folderName);
}
// Setup GroupDocs.Viewer config
ViewerConfig config = new ViewerConfig();
config.setStoragePath("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.
DocumentInfoOptions options = new DocumentInfoOptions();
options.getArchiveOptions().setFolderName("FirstLevelFolder/SecondLevelFolder");
// Get archive document info
ArchiveDocumentInfoContainer documentInfoContainer = (ArchiveDocumentInfoContainer) htmlHandler.getDocumentInfo(guid, options);
for (String folderName : documentInfoContainer.getFolders())
{
System.out.println("Folder name: " + folderName);
}
// Setup GroupDocs.Viewer config
ViewerConfig config = new ViewerConfig();
config.setStoragePath("c:\\storage");
// Create image handler
ViewerImageHandler imageHandler = new ViewerImageHandler(config);
// Create PDF file security
String ownerPassword = "owner password";
String userPassword = "user password";
int denyPrinting = PdfFilePermissions.ALL ^ PdfFilePermissions.PRINTING;
PdfFileSecurity pdfFileSecurity = new PdfFileSecurity(ownerPassword, userPassword, denyPrinting);
// Create options
PdfFileOptions pdfFileOptions = new PdfFileOptions();
pdfFileOptions.setPdfFileSecurity(pdfFileSecurity);
String guid = "document.doc";
FileContainer fileContainer = imageHandler.getPdfFile(guid, pdfFileOptions);
// Setup GroupDocs.Viewer config
ViewerConfig config = new ViewerConfig();
config.setStoragePath("c:\\storage");
// Create HTML or image handler
ViewerImageHandler imageHandler = new ViewerImageHandler(config);
String guid = "archive.zip";
// Set option to retrieve list of folders from certain folder.
ImageOptions options = new ImageOptions();
options.getArchiveOptions().setFolderName("FirstLevelFolder1");
// Render document into image
List<PageImage> pages = imageHandler.getPages(guid, options);
for (PageImage page : pages)
{
// use page.getStream() to work with rendering result
}
// Setup GroupDocs.Viewer config
ViewerConfig config = new ViewerConfig();
config.setStoragePath("c:\\storage");
// Create HTML or image handler
ViewerImageHandler imageHandler = new ViewerImageHandler(config);
String guid = "archive.zip";
// Render document into image
List<PageImage> pages = imageHandler.getPages(guid);
for (PageImage page : pages)
{
// use page.getStream() to work with rendering result
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.