Controller loading
Request a document when needed
Use the button to request a prepared invoice from the server and load it into the existing editor session.
Useful for dynamic documentsThe endpoint can apply authorization, retrieve a database document, or generate content before returning the editor data.
Ready to tryUse the controls above to interact with this demo.
What this demonstrates
Loading from Controller
Controller loading keeps document retrieval and preparation on the server while allowing the page to load quickly with an empty editor shell.
Key members
Load returned document data
TXTextControl.loadDocument
Request the endpoint
fetch
How it works
The button requests the demo controller, which loads the invoice into a server-side ServerTextControl and returns Base64 internal document data. The browser passes that data to TXTextControl.loadDocument.
The same pattern can load a document selected from a database or generated for the current user. Keep the endpoint responsible for authorization and format validation before returning document data.
const response = await fetch("/document");
const documentData = await response.text();
TXTextControl.loadDocument(
TXTextControl.StreamType.InternalUnicodeFormat,
documentData,
() => console.log("Document loaded"),
undefined,
showError);
NuGet packages
TXTextControl.TextControl.Core.SDK
34.0.4
Provides the core document model and server-side document processing APIs.
dotnet add package TXTextControl.TextControl.Core.SDK --version 34.0.4
Provides the browser-based TX Text Control document editor and JavaScript API.
dotnet add package TXTextControl.Web --version 34.4.0
TXTextControl.Web.DocumentEditor.Backend
34.4.0
Hosts the WebSocket-based backend used by the browser document editor.
dotnet add package TXTextControl.Web.DocumentEditor.Backend --version 34.4.0
Source files
See the implementation
The view, browser behavior, and controller are encapsulated in Demos/RichTextEditor/DocumentManagement/FromController.