TX Text Control .NET Server

DocumentViewerElement Class

Class

Description

Hosts a document viewer and exposes its supported viewer API through a custom element. The initial `dock`, `view`, `toolbar-docked`, and `show-thumbnail-pane` values may be supplied as readable attributes. The element initializes itself when connected, preserves its controller and document state across temporary disconnects, and cannot be reused after dispose(). A document provider is the component that loads document data and supplies the viewer with pages, text, and document-saving functionality. The viewer can use the server-side provider backed by TX Text Control endpoints or the optional PDF.js provider configured through the `pdfjs` property of DocumentLoadSettings. Use the native `addEventListener()` method for the lifecycle events `documentViewerLoading` and `documentViewerLoaded` and for the bubbling viewer events `documentLoaded`, `zoomChanged`, and `annotationsChanged`. The viewer event payload is available as `event.detail`; link events can be canceled with the native `event.preventDefault()` method.

Syntax

DocumentViewerElement

Examples

Subscribe to events on an existing document viewer element.

const element = document.querySelector("tx-document-viewer");
element.addEventListener("documentLoaded", event => {
    console.log(event.detail);
});

Members

Properties

PropertyDescription
annotationsControls annotation import/export, stamp definitions, and annotation UI.
formsReads and validates form fields and controls form-field interaction.
signaturesControls the document-signing workflow.
StreamTypeStream type constants accepted by save and download operations.
toolbarControls the main toolbar and its contextual toolbars.
trackedChangesTracked-change state and toolbar operations.
userNamesUser names available to annotation and comment workflows. The first entry is treated as the current user.

Methods

MethodDescription
cancelSearchClears the active search and its result overlays.
disposePermanently releases the controller and all resources owned by the element. Calling this method more than once has no effect. A disposed element cannot be initialized again; create a new element instead.
downloadDocumentSaves the current document and starts a browser download.
findSearches the current document, ignoring case unless requested otherwise. Search results are produced asynchronously and displayed by the viewer.
isSidebarEnabledReports whether the left sidebar is currently visible.
loadDocumentLoads a Base64-encoded document and replaces the currently displayed document. Provider and rendering failures resolve to `false`. Invalid document data or lifecycle violations may reject the returned promise.
nextSearchResultSelects the next or previous search result.
printDocumentStarts the browser print workflow for the current document.
saveDocumentStarts saving the current document and returns a DocumentSaveResult. Its base64() or arrayBuffer() method returns the saved data asynchronously.
scrollToPageScrolls the document viewport to a page.
setSubmitCallbackObsolete. This method will be removed in one of the next versions. Use `element.signatures.setSubmitCallback()`. Sets the callback used by subsequent signature submissions.
setZoomFactorApplies an absolute zoom factor to the document.
signatureCancelObsolete. This method will be removed in one of the next versions. Use `element.signatures.cancelSigningProcess()`. Cancels the active signature workflow.
signaturePadClearObsolete. This method will be removed in one of the next versions. Use `element.signatures.clearSignaturePad()`. Clears the current signature data.
signatureRetrieveObsolete. This method will be removed in one of the next versions. Use `element.signatures.retrieveSignature()`. Restores signature data from browser storage.
signatureStoreObsolete. This method will be removed in one of the next versions. Use `element.signatures.storeSignature()`. Stores current signature data in browser storage.
startSignatureProcessObsolete. This method will be removed in one of the next versions. Use `element.signatures.startSigningProcess()`. Starts the signature workflow.
submitObsolete. This method will be removed in one of the next versions. Use `element.signatures.submit()`. Submits the current document through the signature workflow.
toggleFullScreenToggles browser fullscreen, or toggles window docking when fullscreen is unavailable.
toggleMultiplePageViewToggles whether pages flow into rows when space allows.
toggleSelectionActivates, deactivates, or toggles text selection.
toggleSidebarToggles the left sidebar.
toggleToolbarToggles the main toolbar.