// For complete examples and data files, please go to https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-Java
try {
// Setup GroupDocs.Viewer config
ViewerConfig config = Utilities.getConfiguration();
// Create html handler
ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);
String guid = fileName;
// Options to convert countPagesToConvert consecutive pages starting
// from pageNumber
HtmlOptions options = new HtmlOptions();
options.setPageNumber(pageNumber);
options.setCountPagesToConvert(countPagesToConvert);
List<PageHtml> pages = htmlHandler.getPages(guid, options);
for (PageHtml page : pages) {
Utilities.saveAsHtml(page.getPageNumber() + "_" + fileName, page.getHtmlContent());
}
} catch (Exception exp) {
System.out.println("Exception: " + exp.getMessage());
exp.printStackTrace();
}