usmanazizgroupdocs
3/6/2017 - 3:35 PM

GetPrintableHTML.cs

// For complete examples and data files, please go to https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-.NET
//Get Configurations
ViewerConfig config = Utilities.GetConfigurations();

// Create html handler
ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);

// Guid implies that unique document name 
string guid = DocumentName;

// Setup watermark and style
Watermark watermark = new Watermark("Watermark text");
string css = "a { color: hotpink; }";

// Setup printable options
var options = new PrintableHtmlOptions();
options.Watermark = watermark;
options.Css = css;

// Get document html for print with custom css and watermark
var container = htmlHandler.GetPrintableHtml(guid, options);

Console.WriteLine("Html content: {0}", container.HtmlContent);