usmanazizgroupdocs
8/25/2016 - 8:20 AM

RenderDocumentAsHtmlWithResourcePrefix.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;

//Instantiate the HtmlOptions object
HtmlOptions options = new HtmlOptions();

//To get html representations of pages with embedded resources
options.IsResourcesEmbedded = false;

//Set resource prefix
options.HtmlResourcePrefix = "http://contoso.com/api/getResource?name=";

//To ignore resource prefix in CSS 
//options.IgnoreResourcePrefixForCss = true;

//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);
}