// 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;
// instantiate the HtmlOptions object
HtmlOptions options = new HtmlOptions();
options.IsResourcesEmbedded = false;
// set password if document is password protected.
if (!String.IsNullOrEmpty(DocumentPassword))
options.Password = DocumentPassword;
// add watermark
Watermark watermark = new Watermark("This is watermark text");
watermark.Color = Color.Red;
watermark.Position = WatermarkPosition.Diagonal;
watermark.Width = 100;
watermark.FontName = "\"Comic Sans MS\", cursive, sans-serif";
options.Watermark = watermark;
// get document pages in html form
List<PageHtml> pages = htmlHandler.GetPages(guid, options);
foreach (PageHtml page in pages)
{
// save each page at disk
Utilities.SaveAsHtml(page.PageNumber + "_" + DocumentName, page.HtmlContent);
}