Created
August 16, 2019 07:24
-
-
Save GroupDocsGists/f45159cf559053d41252a2069ec74425 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Set output directory for saving rendered pages | |
string pageFilePathFormat = Path.Combine("D:\\output", "page_{0}.html"); | |
using (Viewer viewer = new Viewer("D:\\storage\\sample.docx")) | |
{ | |
// Set options to get HTML with embedded resources | |
HtmlViewOptions options = HtmlViewOptions.ForEmbeddedResources(pageFilePathFormat); | |
// Render document | |
viewer.View(options); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ViewerConfig config = new ViewerConfig(); | |
config.StoragePath = @"D:\\storage\\"; | |
// Create HTML handler | |
ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config); | |
// Guid implies that unique document name | |
string guid = "sample.docx"; | |
// Instantiate the HtmlOptions object | |
HtmlOptions options = new HtmlOptions(); | |
// 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) | |
{ | |
// Access HTML of each page using page.HtmlContent property | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment