# PDF Viewer

Source: https://lumeo.nativ.sh/components/pdf-viewer

# 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

Preview Code

Basic

 / 0

100%[](https://mozilla.github.io/pdf.js/web/compressed.tracemonkey-pldi-09.pdf)

Page 1 of 0 — zoom 100%

Copy Code

Preview Code

With search bar

 / 0

100%[](https://mozilla.github.io/pdf.js/web/compressed.tracemonkey-pldi-09.pdf)

Copy Code

Preview Code

Toolbar-less (chromeless embed)

Copy Code

## 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.
