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.
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.Parameters
Urlstring?nullToolbarbooltrueDefaultScale/MinScale/MaxScaledouble1.25/0.5/3.0Heightstring?"640px"nullfills parentClass/Id/AriaLabel/AdditionalAttributesOnDocumentLoadedEventCallback<int>OnPageChangedEventCallback<PdfViewerPageChangeEventArgs>Page+PageCounton changeMethods (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.