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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TXTextControl.Web.Blazor.DocumentViewer" Version="33.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TXTextControl.Web.Blazor.DocumentViewer" Version="33.0.0" />
                    
Directory.Packages.props
<PackageReference Include="TXTextControl.Web.Blazor.DocumentViewer" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add TXTextControl.Web.Blazor.DocumentViewer --version 33.0.0
                    
#r "nuget: TXTextControl.Web.Blazor.DocumentViewer, 33.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=TXTextControl.Web.Blazor.DocumentViewer&version=33.0.0
                    
Install TXTextControl.Web.Blazor.DocumentViewer as a Cake Addin
#tool nuget:?package=TXTextControl.Web.Blazor.DocumentViewer&version=33.0.0
                    
Install TXTextControl.Web.Blazor.DocumentViewer as a Cake Tool

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:

  1. Add the controller for the Document Viewer.
IApplicationBuilder.Services.AddControllers()
  1. Activate the routing.
WebApplication.UseRouting()
  1. 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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