Rendering to HTML

When rendering to HTML all pages of the source documents are rendered as separate HTML documents.

GroupDocs.Viewer for .NET provides two resources management options for CSS, fonts, images, etc.:

  • Rendering to HTML with external resources - stores page resources near to HTML which allows to reuse common resources across separate pages and dramatically reduce page size and loading speed.
  • Rendering to HTML with embedded resources - integrates page resources into HTML and makes each document page self-sufficient. The drawback is that page size and loading speed may decrease.

Rendering to HTML with external resources

The following code shows how to render document to HTML with external resources.

using (Viewer viewer = new Viewer("sample.docx"))
{
   HtmlViewOptions viewOptions = HtmlViewOptions.ForExternalResources();
   viewer.View(viewOptions);
}

Rendering to HTML with embedded resources

The following code shows how to render document to HTML with embedded resources.

using (Viewer viewer = new Viewer("sample.docx"))
{
    HtmlViewOptions viewOptions = HtmlViewOptions.ForEmbeddedResources();
    viewer.View(viewOptions);
}