usmanazizgroupdocs
11/9/2016 - 2:01 PM

RenderCustomNumberOfPages.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 page numbers to render
options.PageNumbersToRender = new List<int> { 2, 3 };

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