TX Text Control .NET Server

JavaScript API

Topic

Code that runs in the browser controls the Document Editor and the Document Viewer through two JavaScript objects: TXTextControl for the editor and TXDocumentViewer for the viewer. Their references list every object, property, method and event with its syntax and parameters. Both APIs are the same in every frontend, whether the component comes from the ASP.NET Core HTML helper, a plain JavaScript page or the Angular or React packages, and the Blazor component of the Document Editor works with the same TXTextControl object.

The two objects are independent APIs with different conventions. Knowing which one you are working with, and how it returns results, makes the reference pages easier to read.

The Two APIs

Document EditorDocument Viewer
ObjectTXTextControlTXDocumentViewer
What it controlsThe document in the editor: text, formatting, tables, images, fields, sections, tracked changes, comments, the selection and the ribbonThe displayed document: loading and saving, search, printing, zoom, annotations, form fields, tracked changes, signatures and the toolbar
Ready for your codeAfter the editor has raised textControlLoadedAfter the viewer has raised documentViewerLoaded on window
How methods return resultsAsynchronous methods pass their results to callback functionsLoading and saving return promises; most other members return their result directly
EventsaddEventListener of TXTextControladdEventListener of TXDocumentViewer
GuideJavaScript API in Document EditorJavaScript API in Document Viewer

Enumerations of the editor are properties of its object, such as TXTextControl.StreamType, and the viewer has its own, such as TXDocumentViewer.StreamType.

How the Reference Is Organized

Each API has a page per object. The main objects, TXTextControl and TXDocumentViewer, lead to the objects your code reaches through their properties, such as the tables of a document or the annotations in the viewer. The page of an object lists its properties, methods and events. The page of a member shows its syntax, its parameters, the value or callback it returns and the version it was introduced in.

The Document Editor's reference also documents the callback types and the objects that event handlers receive, such as DocumentLoadedEventArgs. The objects of the Document Viewer's reference are fewer: the viewer, its toolbar, annotations, forms, tracked changes, signatures and the settings objects for loading, saving and signing documents.

Find the Right Page

If you want toRead
Understand callbacks, the object model and when the editor's object existsJavaScript API in Document Editor
Find the events of the editor and their order during initializationEvents
Understand promises and the objects of the viewerJavaScript API in Document Viewer
Handle the events of the viewerEvents
Look up a member of the editorDocument Editor
Look up a member of the viewerDocument Viewer
Configure the Angular or React components that create the editor and the viewerAngular API or React API

Pages in This Section

  • Document Editor: the reference of the TXTextControl object and the objects below it.
  • Document Viewer: the reference of the TXDocumentViewer object and the objects below it.