Load document using the local path string

You can load a document from a local disk using a path to a file. GroupDocs.Viewer opens the file in the read-only mode.

The following code snippet shows how to load a document using the local path string:

// Specify a path to a file.
string filePath = "sample.docx";
// Render the file.
using (Viewer viewer = new Viewer(filePath)) 
{
    HtmlViewOptions viewOptions = HtmlViewOptions.ForEmbeddedResources();
    viewer.View(viewOptions);
}