Web Component Advantages
Internally, the DocumentViewer will be changed to a Web Component, but can be also added via the MVC HTML Helper or the Angular component. Major advantages of this approach is that each instance of the Web Component uses an encapsulated shadow DOM with it's own style and markup. These are the major advantages:
- Create more than one instance of the DocumentViewer
- Style each instance individually
Adding Web Components
The element name of the Web Component is <tx-document-viewer> and can be simply added to any HTML page:
When looking at the dynamically created DOM including the shadow DOM created by the TX Text Control DocumentViewer, you can see that the DocumentViewer instance has been created in the shadow DOM:
Each instance is triggering a documentViewerLoaded event that gives access to the created instance:
But a better way to access the created instance(s) is to use the id of the created Web Component element:
The new concept will be backwards compatible. In case, you are using the ASP.NET Core MVC HTML Helper, you can still use the helper and access the viewer programmatically using the TXDocumentViewer object. Even if you are using multiple instances of the viewer inserted using the MVC HTML Helper, the last created instance is accessible through the TXDocumentViewer object.
This version is currently in beta and will be released as an RC (Release Candidate) preview release very soon for your own testing. This new feature and many others are part of the current major release 31.0. The version of the DocumentViewer that is going to have these changes is 31.2.2.
Further upcoming features in this version:
- PDF.js rendering
- .NET compatible regular expressions for form field validation
- Asynchronous page refreshing after zooming