Document Viewer API
Explore the viewer surface
Use the document toolbar to navigate, search, print, and download. These actions show the zero-footprint viewer experience before you move on to feature-specific samples.
First lookNavigate a real document
Discover the browser viewer before moving into specialized APIs.
LIVE
1Explore the workspace
Open thumbnails or hide the toolbar while the document remains loaded.
Ready to tryUse the controls above to interact with this demo.
What this demonstrates
Read documents in any browser
Display Word-compatible documents with accurate pagination, thumbnails, text selection, search, printing, and downloading in a zero-footprint browser component.
Component settings
DocumentViewerSettings
Key members
DocumentViewerSettings define the initial document and the browser viewing experience.
@Html.TXTextControl().DocumentViewer(settings => {
settings.Dock = DocumentViewerSettings.DockStyle.Fill;
settings.ShowThumbnailPane = true;
settings.DocumentPath = documentPath;
}).Render()
How it works
The Razor view adds the viewer with Html.TXTextControl().DocumentViewer and assigns its document through DocumentPath. DockStyle.Fill uses the complete demo stage, while IsSelectionActivated and ShowThumbnailPane configure the initial viewing experience.
Key code
This is the Razor helper that adds the Document Viewer to the page.
<div class="tx-editor-host">
@Html.TXTextControl().DocumentViewer(settings => {
settings.Dock = DocumentViewerSettings.DockStyle.Fill;
settings.IsSelectionActivated = true;
settings.ShowThumbnailPane = true;
settings.DocumentPath = documentPath;
}).Render()
</div>
NuGet packages
Displays supported document and PDF formats in the browser.
dotnet add package TXTextControl.Web.DocumentViewer --version 34.2.0
Source files
See the implementation
The view, browser behavior, assets, and controller are encapsulated in Demos/DocumentViewer/Concept.