Skip to main content

Blazor PDF Viewer

The Blazor PDF Viewer component allows users to view PDF files directly in the browser, without relying on third-party browser tools or extensions.


NameTypeDefaultRequiredDescriptionAdded Version
Urlstringnull✔️Gets or sets the PDF URL.1.11.0

Callback Events

EventDescriptionAdded Version
OnDocumentLoadedThis event fires immediately after the PDF document is loaded.1.11.0
OnPageChangedThis event fires immediately after the page is changed.1.11.0


Basic usage

Blazor Bootstrap: Blazor PDF Viewer Component - Basic usage

<PdfViewer Class="mb-3"
OnPageChanged="OnPageChanged" />
@code {
private string eventLog { get; set; } = $"Last event: ..., CurrentPage: 0, TotalPages: 0";

private async Task OnDocumentLoaded(PdfViewerEventArgs args)
=> eventLog = $"Last event: OnDocumentLoaded, CurrentPage: {args.CurrentPage}, TotalPages: {args.TotalPages}";

private async Task OnPageChanged(PdfViewerEventArgs args)
=> eventLog = $"Last event: OnPageChanged, CurrentPage: {args.CurrentPage}, TotalPages: {args.TotalPages}";

See demo here.