This NuGet package contains the files needed to develop a .NET 8.0 or higher Blazor Web App with TX Text Control 33.0 with support for the TX Text Control Document Viewer.
License
—
Deps
1
Install Size
—
Vulns
✓ 0
Published
Nov 10, 2025
$ dotnet add package TXTextControl.Web.Blazor.DocumentViewerEnhance your web applications with document viewing, signing, annotation, and collaboration. Seamlessly integrate electronic signatures into your on-premises applications and sign any supported document with ease.
This package contains a Blazor component for the document viewer. A backend service is required to use the component. The backend can be hosted in a Blazor App.
Requires enabling interactive rendering with server-side prerendering on the hosting Blazor server, e.g. by adding @rendermode InteractiveServer to the top of the .razor page.
Simply add the Document Viewer to the page using the following syntax:
<TXTextControl.Web.Blazor.DocumentViewer.DocumentViewer @ref=_documentViewer></TXTextControl.Web.Blazor.DocumentViewer.DocumentViewer>
Optionally set the BasePath parameter if you are using another backend server for hosting. By default, the base path is set to the location of the hosting Blazor application.
<TXTextControl.Web.Blazor.DocumentViewer.DocumentViewer @ref=_documentViewer BasePath="https://backend.documentviewer"></TXTextControl.Web.Blazor.DocumentViewer.DocumentViewer>
Use the component's reference for loading a document:
@rendermode InteractiveServer
@page "/"
<TXTextControl.Web.Blazor.DocumentViewer.DocumentViewer @ref=_documentViewer></TXTextControl.Web.Blazor.DocumentViewer.DocumentViewer>
<button @onclick="LoadDocument">Load Document</button>
@code {
private TXTextControl.Web.Blazor.DocumentViewer.DocumentViewer _documentViewer;
public async Task LoadDocument()
{
string html = "<html><body>Hello World!</body></html>";
await _documentViewer.LoadDocument(System.Text.UTF8Encoding.UTF8.GetBytes(html));
}
}
The JavaScript interface provides additional ways to control the viewer or perform other actions. Refer to the JavaScript API documentation for additional options.
Install the required packages TXTextControl.Web.DocumentViewer and TXTextControl.TextControl.Core.SDK to set up the backend.
For hosting the backend in a Blazor App:
IApplicationBuilder.Services.AddControllers().WebApplication.UseRouting().WebApplication.UseTXDocumentViewer().Your code might look something like the following::
// Example: program.cs
using TXTextControl.Web.MVC.DocumentViewer;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddRazorComponents()
.AddInteractiveServerComponents();
// Hosting Step 1: Add the controller for the Document Viewer.
builder.Services.AddControllers();
builder.Services.AddSignalR(hubOptions =>
{
hubOptions.MaximumReceiveMessageSize = 10 * 1024 * 1024; // 10MB
});
var app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error", createScopeForErrors: true);
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseCors("AllOrigins");
app.UseStaticFiles();
// Hosting Step 2: Activate the routing for Document Viewer.
app.UseRouting();
app.UseAntiforgery();
// Hosting Step 3: Configure the Document Viewer backend.
app.UseTXDocumentViewer();
app.MapRazorComponents<App>()
.AddInteractiveServerRenderMode();
app.Run();