DocuVieware is an HTML5-based viewer and document management toolkit. It is built to work with all modern browsers and devices to handle documents from any source. The DocuVieware UI supports annotations, thumbnails, bookmarks, as well as custom snap-ins that extend functionality. DocuVieware enables you to pan, zoom, rotate, select text, and print documents. And you can embed it into existing applications with just a few lines of code.
DocuVieware integrates directly with ASP.NET and ASP.NET Core applications, as well as with any other web technology that uses REST APIs. The DocuVieware website offers several tutorials for implementing features on different platforms.
In addition to the server-side API with support for thousands of functions, DocuVieware provides a JavaScript API for full control over the available UI features and the control appearance. The rich functionality and the ease of integration make DocuVieware an ideal solution for document viewing and manipulation.
Blazor is a web platform with which DocuVieware now integrates. Blazor allows C# developers to build interactive web clients without relying on JavaScript. The code for both the client and the server can be written using C#. Blazor also supports existing .NET Standard libraries. The Blazor rendering engine is based on reusable Razor components whose syntax combines HTML with C# code.
Blazor apps can be written using one of two hosting models: Blazor WebAssembly and Blazor Server.
Blazor WebAssembly allows your app to run entirely in the browser using a technology called WebAssembly. You can think of WebAssembly as a sandboxed virtual machine that runs in modern browsers on desktops, laptops, phones, tablets, and edge devices. WebAssembly is built-in so it requires no plugin to operate.
Blazor WebAssembly uses a virtual machine to load a version of the .NET Core runtime and provide additional services to render the browser UI and fetch remote resources. This hosting model is typically deployed in one of two ways: as a standalone static website or as a client app relying on an ASP.NET Core server app with controllers that expose Web API endpoints.
Blazor WebAssembly apps can even be installed to run offline as Progressive Web Applications (PWA).
Blazor Server runs the engine on the server. The client receives a small JavaScript shim that sets up a real-time connection with the server using SignalR. The server renders the UI and sends HTML to the client. The client captures browser events and relays them back to the server. This results in a smaller client footprint and enables more advanced server-side scenarios. The trade-off is that the server must scale to handle all client connections and the hosting model in general lacks offline support.
The client/server nature of DocuVieware makes it embeddable in both hosting models. The client control exposes a JavaScript API. It is possible to both call JavaScript from the .NET application and call .NET APIs from JavaScript. The DocuVieware REST API makes it possible to integrate DocuVieware with the static website version of Blazor WebAssembly.
This tutorial focuses on the ASP.NET Core hosted version of Blazor WebAssembly. Let’s dig right in.
Create the Visual Studio Project
Make sure you have taken care of the following:
- Install DocuVieware and obtain a license key.
- Install the latest version of Visual Studio 2019 with the NET and web development workload selected (this tutorial uses version 16.6.2).
- Install the .NET Core SDK along with Visual Studio 2019. Check that you are on the latest (non-preview) version (this tutorial uses version 3.1.301). You can check your version by running this command on the command line: