GroupDocsGists
10/24/2017 - 1:08 PM

Examples-GroupDocs.Viewer.Examples.Java-src-main-java-com-groupdocs-viewer-examples-ViewGenerator-renderContentWithRenderLayersSeparately.java

// For complete examples and data files, please go to https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-Java
// Setup GroupDocs.Viewer config
ViewerConfig config = Utilities.getConfiguration();
// Create html handler
ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);
String guid = fileName;
// Set pdf options to render pdf layers into separate html elements
HtmlOptions options = new HtmlOptions();
options.getPdfOptions().setRenderLayersSeparately(true); // Default value is false
 
// Get pages
List<PageHtml> pages = htmlHandler.getPages(guid, options);
 
for (PageHtml page : pages)
{
    System.out.println("Page number: " + page.getPageNumber());
    System.out.println("Html content: " + page.getHtmlContent());
}