Last active
December 10, 2019 05:55
-
-
Save GroupDocsGists/bf4cf450bb954375e21ecdc7544fdc56 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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