usmanazizgroupdocs
3/6/2017 - 3:35 PM

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://example.com/api/pages/{page-number}/resources/{resource-name}";
//The {page-number} and {resource-name} patterns will be replaced with current processing page number and resource name accordingly.

//To ignore resource prefix in CSS 
//options.IgnorePrefixInResources = 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);
}