TXTextControl.Web.Blazor.DocumentViewer
33.0.0
Prefix Reserved
dotnet add package TXTextControl.Web.Blazor.DocumentViewer --version 33.0.0
NuGet\Install-Package TXTextControl.Web.Blazor.DocumentViewer -Version 33.0.0
<PackageReference Include="TXTextControl.Web.Blazor.DocumentViewer" Version="33.0.0" />
<PackageVersion Include="TXTextControl.Web.Blazor.DocumentViewer" Version="33.0.0" />
<PackageReference Include="TXTextControl.Web.Blazor.DocumentViewer" />
paket add TXTextControl.Web.Blazor.DocumentViewer --version 33.0.0
#r "nuget: TXTextControl.Web.Blazor.DocumentViewer, 33.0.0"
#addin nuget:?package=TXTextControl.Web.Blazor.DocumentViewer&version=33.0.0
#tool nuget:?package=TXTextControl.Web.Blazor.DocumentViewer&version=33.0.0
TX Text Control - Document Viewer - Blazor Component
Enhance 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.
Getting Started
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.
Using the component
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 (https://docs.textcontrol.com/textcontrol/asp-dotnet/ref.javascript.api..document.viewer.htm) for additional options.
Hosting in a Blazor App
Install the packages
Install the required packages TXTextControl.Web.DocumentViewer and TXTextControl.TextControl.Core.SDK to set up the backend.
Setup a Blazor App as backend
For hosting the backend in a Blazor App:
- Add the controller for the Document Viewer.
IApplicationBuilder.Services.AddControllers()
- Activate the routing.
WebApplication.UseRouting()
- Setup and configure the backend.
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();
// 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();
// 2. Activate the routing for Document Viewer.
app.UseRouting();
app.UseAntiforgery();
// 3. Configure the Document Viewer backend.
app.UseTXDocumentViewer();
app.MapRazorComponents<App>()
.AddInteractiveServerRenderMode();
app.Run();
Help Resources
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net8.0
- Microsoft.AspNetCore.Components.Web (>= 8.0.11)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
33.0.0 | 436 | 8 days ago |