DocumentViewer Class
- Namespace
TXTextControl.DocumentServer. Web
- Package
TXTextControl.from the private NuGet feed or Text Control Offline PackagesTextControl. ASP. SDK
- Assembly
TXDocumentServer.Web. DocumentViewer. dll
- Install
dotnet add package TXTextControl..NET 8 and later. For .NET Framework, referenceTextControl. ASP. SDK TXDocumentServer.from the setup.Web. DocumentViewer. dll
- Inherits
- Composite
Control - Document
Viewer
- Composite
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 : CompositeControlPublic Class DocumentViewer
Inherits CompositeControlExamples
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.");Dim documentViewer As New TXTextControl.Web.MVC.DocumentViewer.DocumentViewer()
Console.WriteLine("Document Viewer is ready for the document workflow.")Members
Constructors
| Constructor | Description |
|---|---|
| DocumentViewer | Initializes a new instance of the DocumentViewer class. |
Properties
| Property | Description |
|---|---|
| DocumentController | Gets or sets the DocumentServer.DocumentController object that is associated with the DocumentServer.Web.DocumentViewer component. |
| DocumentPath | Gets 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. |
| EditMode | Gets or sets whether the document viewer renders forms editable, i.e. with input fields at every form field's location, or read-only. |
| FieldBorderColor | Gets or sets the color of the field borders, that is used when FieldBorderStyle is not None. |
| FieldBorderStyle | Gets or sets whether and if so how the field borders are rendered, when EditMode is set to Edit. |
| Interpolation | Gets 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. |
| InterpolationMode | Gets or sets the interpolation mode which is used for rendering the document. This like DocumentServer.Web.DocumentViewer.Interpolation, this setting affects the rendering result. |
| PageAnimationDuration | Gets or sets the duration of the page animations in seconds. |
| PageAnimations | Specifies whether CSS transition animations should be used or not when navigating through pages. |
| PageNumber | Gets or sets the page number that the DocumentServer.Web.DocumentViewer is displaying or should display respectively. Returns 0, if no document is loaded. |
| RoundedPageCorners | Specifies whether rounded document page corners should be used or not. |
| ShowEditButton | Specifies whether the edit button is shown or not. |
| ToolBar | Specifies whether the document viewer's tool bar is displayed or not. |
| TotalPages | Gets the total number of pages the loaded document contains. Returns 0 if no document is loaded. |
| ZoomFactor | Gets or sets the zoom factor in percent. |
| ZoomTo | Gets or sets the zoom behavior of the DocumentServer.Web.DocumentViewer. |
Methods
| Method | Description |
|---|---|
| Dispose | Frees all resources used by the DocumentViewer instance. |
| LoadDocument | Loads a document that is used for further processing. |
| LoadDocumentFromMemory | Loads a document from a file that is used for further processing. |
| LoadFormData | Not described in the reference. public void LoadFormData(DataTable formData); |
| Save | Initiates 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. |
| SaveUserInput | Initiates 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
| Event | Description |
|---|---|
| SaveDocument | Occurs 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. |
| SaveFormData | Occurs 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. |