DS Server

DocumentViewerController Class

Class

Description

Creates the controller for a document viewer hosted in an existing element. Construction only prepares controller state. Call initialize() before using document, layout, toolbar, form, signature, annotation, or viewer-event operations. Call dispose() when the host permanently releases the viewer. 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.

Syntax

DocumentViewerController

Examples

Create and initialize a viewer controller for an existing host element.

const controller = new DocumentViewerController(container, {
    resources,
    view: 1,
    dock: 1
});
await controller.initialize();

Members

Constructors

ConstructorDescription
DocumentViewerControllerInitializes a new instance of the DocumentViewerController class.

Properties

PropertyDescription
annotationsControls annotation import/export, stamp definitions, and annotation UI. Available after initialize() completes.
formsReads and validates form fields and controls form-field interaction. Available after initialize() completes.
signaturesControls the document-signing workflow. Available after initialize() completes.
StreamTypeStream type constants accepted by save and download operations.
toolbarControls the main toolbar and its contextual toolbars. Available after initialize() completes.
trackedChangesTracked-change state and toolbar operations. Available after initialize() completes.

Methods

MethodDescription
__init__Obsolete. This method will be removed in one of the next versions. Use `controller.initialize()`. Initializes the viewer using the legacy method name.
addEventListenerRegisters a listener for a public viewer event.
cancelSearchClears the active search and its result overlays.
disposePermanently releases all resources owned by the controller.
downloadDocumentSaves the current document and starts a browser download.
findSearches the current document, ignoring case unless requested otherwise.
initializeInitializes the viewer DOM and its interaction components.
loadDocumentLoads a Base64-encoded document and replaces the currently displayed document.
nextSearchResultSelects the next or previous search result.
printDocumentStarts the browser print workflow for the current document.
resumeResumes connection-bound listeners and refreshes layout when initialized.
saveDocumentStarts saving the current document and returns a DocumentSaveResult for reading the saved data as Base64 or binary data.
scrollToPageScrolls the document viewport to a page.
suspendPauses listeners and resources while the viewer is detached.
toggleFullScreenToggles browser fullscreen, or toggles window docking when fullscreen is unavailable.
toggleSelectionActivates, deactivates, or toggles text selection.
toggleSidebarToggles the left sidebar.
toggleToolbarToggles the main toolbar.