TX Text Control .NET Server

DocumentViewer Class

Class|Introduced in 15.0
Namespace
TXTextControl.DocumentServer.Web
Package
TXTextControl.TextControl.ASP.SDK from the private NuGet feed or Text Control Offline Packages
Assembly
TXDocumentServer.Web.DocumentViewer.dll
Install
dotnet add package TXTextControl.TextControl.ASP.SDK .NET 8 and later. For .NET Framework, reference TXDocumentServer.Web.DocumentViewer.dll from the setup.
Inherits
  1. CompositeControl
  2. DocumentViewer

Description

The DocumentViewer class is a .NET component that can be used to display documents in the web browser in ASP.NET projects. The DocumentViewer class can be found in the TXTextControl.DocumentViewer.Web namespace. It is derived from the System.Web.UI.WebControls.CompositeControl class. The following describes only the properties and methods directly defined by the DocumentViewer class. For a list of properties, methods and events inherited from the System.Web.UI.WebControls.CompositeControl class see the .NET Framework reference.

Syntax

public class DocumentViewer : CompositeControl

Examples

The legacy Web Forms document viewer type is not part of the current ASP.NET Core package. The following example uses the current MVC Document Viewer model for the same server-side workflow.

TXTextControl.Web.MVC.DocumentViewer.DocumentViewer documentViewer = new();
Console.WriteLine("Document Viewer is ready for the document workflow.");

Members

Constructors

ConstructorDescription
DocumentViewerInitializes a new instance of the DocumentViewer class.

Properties

PropertyDescription
DocumentControllerGets or sets the DocumentServer.DocumentController object that is associated with the DocumentServer.Web.DocumentViewer component.
DocumentPathGets or sets the path to the document, which will be displayed in the DocumentServer.Web.DocumentViewer. The document will be processed and displayed the next time the DocumentServer.Web.DocumentViewer is initialized. Please note that the extension of the specified filename must match the file's type, since the viewer determines the file type based on its extension and passes this information on to the DocumentServer.DocumentController which then in turn will try to load the document. Obviously, this process will fail, if the file extension suggests the wrong file type.
EditModeGets or sets whether the document viewer renders forms editable, i.e. with input fields at every form field's location, or read-only.
FieldBorderColorGets or sets the color of the field borders, that is used when FieldBorderStyle is not None.
FieldBorderStyleGets or sets whether and if so how the field borders are rendered, when EditMode is set to Edit.
InterpolationGets or sets whether the rendered document is interpolated during the process. The higher the value, the better the quality, but also the slower the rendering process and vice versa.
InterpolationModeGets or sets the interpolation mode which is used for rendering the document. This like DocumentServer.Web.DocumentViewer.Interpolation, this setting affects the rendering result.
PageAnimationDurationGets or sets the duration of the page animations in seconds.
PageAnimationsSpecifies whether CSS transition animations should be used or not when navigating through pages.
PageNumberGets or sets the page number that the DocumentServer.Web.DocumentViewer is displaying or should display respectively. Returns 0, if no document is loaded.
RoundedPageCornersSpecifies whether rounded document page corners should be used or not.
ShowEditButtonSpecifies whether the edit button is shown or not.
ToolBarSpecifies whether the document viewer's tool bar is displayed or not.
TotalPagesGets the total number of pages the loaded document contains. Returns 0 if no document is loaded.
ZoomFactorGets or sets the zoom factor in percent.
ZoomToGets or sets the zoom behavior of the DocumentServer.Web.DocumentViewer.

Methods

MethodDescription
DisposeFrees all resources used by the DocumentViewer instance.
LoadDocumentLoads a document that is used for further processing.
LoadDocumentFromMemoryLoads a document from a file that is used for further processing.
LoadFormDataNot described in the reference. public void LoadFormData(DataTable formData);
SaveInitiates saving the currently loaded document. The actual saving is performed by a method which has to be bound to the DocumentServer.Web.DocumentViewer.SaveDocument event.
SaveUserInputInitiates saving the currently loaded form's user input. The actual saving is performed by a method which has to be bound to the DocumentServer.Web.DocumentViewer.SaveFormData event.

Events

EventDescription
SaveDocumentOccurs when DocumentServer.Web.DocumentViewer.Save has been called, while specifying the format parameter only. The event handler receives an argument of type DocumentServer.Web.DocumentViewer.SaveDocumentEventArgs containing data related to this event.
SaveFormDataOccurs when DocumentServer.Web.DocumentViewer.SaveUserInput has been called. The event handler receives an argument of type DocumentServer.Web.DocumentViewer.SaveFormDataEventArgs containing data related to this event.