PDF Viewer
Inline PDF document viewer powered by Mozilla pdf.js — renders documents page-by-page on a canvas with page navigation, zoom controls, optional text search, and a download shortcut.
Satellite package. The PdfViewer lives in
Lumeo.PdfViewer — install it alongside the core Lumeo package.
pdf.js is loaded on demand from jsDelivr the first time a PdfViewer mounts; no
npm build step is required for consumers.
When to Use
- Embedding PDFs (contracts, invoices, reports) inline in a Blazor page
- Document preview surfaces where the browser's built-in viewer is too heavy or inconsistent
- Read-only flows that benefit from page navigation, zoom, and text search
API Reference
PdfViewer
| Prop | Type | Default | Description |
|---|---|---|---|
| Src | string? | null | PDF URL or data: URL. Required. |
| Page | int | 1 | 1-based current page. Two-way bindable. |
| PageChanged | EventCallback<int> | — | Fires when the user navigates to a different page. |
| Zoom | double | 1.0 | Render scale clamped to [0.5, 4.0]. Two-way bindable. |
| ZoomChanged | EventCallback<double> | — | Fires when the user changes zoom. |
| ShowToolbar | bool | true | Hide the whole toolbar row for a chromeless embed. |
| ShowPageNav | bool | true | Show prev/next + page input. |
| ShowZoomControls | bool | true | Show ± zoom buttons and percentage. |
| ShowDownload | bool | true | Show the download shortcut linking to Src. |
| ShowSearch | bool | false | Show the text-search input (returns total match count). |
| OnLoaded | EventCallback<int> | — | Fires once with the total page count when the PDF finishes loading. |
| OnPageChanged | EventCallback<int> | — | Non-binding alternative to PageChanged. |
| OnError | EventCallback<string> | — | Fires when the PDF fails to load or render (CDN unreachable, malformed PDF, worker init failure). Receives the exception message; the built-in EmptyState fallback still renders. |
| Class | string? | null | Extra CSS classes on the root container. |
Accessibility. The canvas wrapper renders
role="document"
with aria-label="PDF document" and a tabindex="0" so it
receives keyboard focus. PageDown / ArrowRight advances, PageUp /
ArrowLeft rewinds, and + / - zoom.