Skip to content
A sample project demonstrating how to integrate PDFTron's WebViewer into a Blazor project
JavaScript CSS HTML Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Data
Pages
Properties
Shared
wwwroot
App.razor
BlazorWebViewerServer.csproj
LICENSE
Program.cs
README.md
Startup.cs
_Imports.razor
appsettings.Development.json
appsettings.json
sample.png

README.md

Blazor PDF Viewer Sample (WebViewer)

WebViewer is a powerful JavaScript-based PDF Library that's part of the PDFTron PDF SDK. It provides a slick out-of-the-box responsive UI that interacts with the core library to view, annotate and manipulate PDFs that can be embedded into any web project.

WebViewer UI

This repo is specifically designed for any users interested in integrating WebViewer into a Blazor project. This project was integrated using the Blazor server-sided application template.

Initial setup

Before you begin, make sure your development environment includes .NET Core 3.0 SDK.

Install

git clone https://github.com/PDFTron/webviewer-blazor-sample.git
cd webviewer-blazor-sample

Run

dotnet run

Navigate to https://localhost:5001/webviewer

WebViewer APIs

See API documentation.

Enabling full API

PDFNetJS Full is a complete browser side PDF SDK, unlocking viewing, parsing and editing of PDF files. To enable full API, you can modify constructor in wwwroot/js/webviewerScripts.js:

initWebViewer: function () {
    const viewerElement = document.getElementById('viewer');
    WebViewer({
        path: 'WebViewer/lib',
        initialDoc: 'https://pdftron.s3.amazonaws.com/downloads/pl/demo-annotated.pdf', // replace with your own PDF file
+        fullAPI: true
    }, viewerElement).then((instance) => {
        // call APIs here
    })
}

You can refer to this guide for more information

License

See license.

You can’t perform that action at this time.