Quickstart

This will guide you through the required steps to get Blazor PDF up and running.

Using Blazor Pdf with a MAUI Blazor Hybrid Application requires additional configuration. Please see the maui specific documentation for more info

Prerequisites

In order to use Blazor PDF, your project must target either .NET 8 or .NET 9

Installation

Grab the latest package from nuget.org

dotnet add package Gotho.BlazorPdf

Configuration

Add the following to your application startup in Program.cs

builder.Services.AddBlazorPdfViewer();

Update your App.razor file to import the required CSS.

<link href="_content/Gotho.BlazorPdf/blazorpdf.min.css" rel="stylesheet"/>

Then, add the namespace to your _Imports.razor file.

@using Gotho.BlazorPdf

You should now be able to use Blazor PDF in your Project! 🚀

Usage

Below is a basic example of the minimum required code in order to display a PDF document. See the rest of the documentation for full configuration options.

<PdfViewer Url="https://raw.githubusercontent.com/mozilla/pdf.js/ba2edeae/web/compressed.tracemonkey-pldi-09.pdf"/>
An unhandled error has occurred. Reload 🗙