usmanazizgroupdocs
4/15/2016 - 10:34 AM

GetDocumentHtmlForPrint.java

// 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 image handler
	ViewerImageHandler imageHandler = new ViewerImageHandler(config);
	String guid = fileName;

	// Get document html for print
	PrintableHtmlOptions options = new PrintableHtmlOptions(guid);
	PrintableHtmlContainer container = imageHandler.getPrintableHtml(options);

	// Save as html
	Utilities.saveAsHtml(fileName, container.getHtmlContent());

} catch (Exception exp) {
	System.out.println("Exception: " + exp.getMessage());
	exp.printStackTrace();
}