usmanazizgroupdocs
11/9/2016 - 2:09 PM

RenderNConsecutivePages.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();

// set starting page number 
options.PageNumber = 2;
options.CountPagesToRender = 2;

// to get html representations of pages with embedded resources
options.IsResourcesEmbedded = 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);
}