Skip to content

Feature Request: add PDF document viewer #570

Description

@Denny09310

Problem

No way to display a PDF inside a Blazor page using the design system. Apps currently fall back to the browser's native viewer, which can't be styled/sized, isn't controllable from code, fires no events, and can't show in-memory documents (no URL).

Proposal

A component that renders PDFs to <canvas> with the library's standard toolbar, controllable via parameters/methods, working on Server, WASM, and Auto.

<BbPdfViewer Url="https://example.com/contract.pdf" Height="600px" />

Parameters

Parameter Type Default Purpose
Url string? null Remote document; changing reloads, clearing empties the viewer
Toolbar bool true Hide for embed-style use (methods still work)
DefaultScale / MinScale / MaxScale double 1.25 / 0.5 / 3.0 Initial zoom + bounds
Height string? "640px" Canvas height; null fills parent
Class / Id / AriaLabel / AdditionalAttributes — — Standard attributes
OnDocumentLoaded EventCallback<int> — Page count after load
OnPageChanged EventCallback<PdfViewerPageChangeEventArgs> — Page + PageCount on change

Methods (usable with Toolbar="false"): PreviousPageAsync, NextPageAsync, GoToPageAsync(int), ZoomInAsync, ZoomOutAsync, SetScaleAsync(double), FitToWidthAsync(), LoadDataAsync(byte[]|Stream) (no URL/network), DownloadAsync(string?), GetCurrentPageAsync(), GetPageCountAsync(), GetScaleAsync()

Out of scope

Text selection, annotations/bookmarks/outline, continuous scroll, password-encrypted documents.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions