| Name |
Type |
Default value |
Description |
|---|
| AllowDropFile |
bool |
false |
Whether a pdf dropped onto the viewer opens in it. The dropped file goes through the same path as the toolbar's open-file button, so OnFileOpened and MaxOpenFileSize apply to it too. |
| BackgroundRendering |
bool |
false |
Offloads document parsing and page rendering to a background thread so scrolling and navigation stay responsive while a complex page renders. Only has an effect when the runtime provides a spare thread (Blazor Server, or a Blazor WebAssembly app built with WasmEnableThreads); on the default single-threaded WebAssembly runtime it is a safe no-op. Seekable stream sources always run server parsing, page/thumbnail builds, search and print off the circuit. |
| Classes |
BitPdfViewerClassStyles? |
null |
Custom CSS classes for the different parts of the viewer. |
| CurrentPage |
int |
1 |
The focused page (1-based), two-way bindable. Reading it gives the page the reader is on; assigning it navigates there. Bound one way (without CurrentPageChanged) the page becomes the host's to control: the viewer then reports navigation through OnPageChanged but does not move the value itself. |
| CursorTool |
BitPdfCursorTool |
BitPdfCursorTool.Select |
What dragging on the document surface does: select text (the default) or pan the document, as the hand tool of a desktop viewer does. |
| DefaultSidebar |
BitPdfSidebar |
BitPdfSidebar.None |
The side panel open when a document first loads. The panel can be changed afterwards from the toolbar or through the ShowSidebar method. |
| EmptyTemplate |
RenderFragment? |
null |
Custom content shown in place of the pages while no document is loaded. Defaults to the NoDocument text. |
| EnableKeyboardShortcuts |
bool |
true |
Whether the viewer handles keyboard shortcuts while it has focus: page navigation (n/j, p/k, PageUp/PageDown, Home/End, plus the arrow keys and Space while one page is shown at a time), zoom (Ctrl +, Ctrl -, Ctrl 0), rotation (r, Shift+r), find (Ctrl+F, Ctrl+G, Shift+Ctrl+G), print (Ctrl+P), download (Ctrl+S), presentation mode (Ctrl+Alt+P) and the sidebar (F4). Find, print and download follow ToolbarItems: leaving their control out of the toolbar leaves their shortcut out too. |
| ErrorTemplate |
RenderFragment<string>? |
null |
Custom content shown in place of the pages when a document fails to load, with the message OnError receives. Announced as an alert, as the default message is. |
| Height |
string? |
null |
The CSS height of the viewer (sets --bit-PdfViewer-height on the instance). When not set, the viewer height is responsive: capped at 780px and shrinking to fit the viewport on small screens. |
| InitialZoomMode |
BitPdfZoomMode |
BitPdfZoomMode.FitWidth |
The initial zoom behavior. |
| LoadingTemplate |
RenderFragment? |
null |
Custom content shown in place of the pages while a document is fetched and parsed. Defaults to a page-shaped placeholder; the loading bar shows either way. |
| MaxOpenFileSize |
long |
67108864 |
The largest file the toolbar's open-file button - and a drop, when AllowDropFile allows one - accepts, in bytes (64 MB by default). The whole file is read into memory, and on Blazor Server it also travels the circuit. |
| MaxRenderedPageCount |
int |
24 |
How many pages stay materialized in the DOM at once. Pages outside the window centered on the current one revert to placeholders and are re-rendered when scrolled back to, which is what keeps a long document from growing the DOM (and a Blazor Server circuit's memory) without bound. |
| MaxRenderedThumbnailCount |
int |
40 |
How many thumbnails stay materialized in the sidebar at once. A thumbnail fragment is as heavy as a full page, so this bounds the sidebar the way MaxRenderedPageCount bounds the document surface. |
| MaxZoom |
double |
8 |
The largest zoom factor the viewer allows (1 means 100%). |
| MinZoom |
double |
0.1 |
The smallest zoom factor the viewer allows (1 means 100%). |
| OnDocumentLoaded |
EventCallback |
|
The callback for when the document opens and loading has cleared. A page that cannot render reports OnError separately. Range details can remain deferred; use LoadDocumentDetailsAsync to await them. |
| OnDownloading |
EventCallback<BitPdfDownloadArgs> |
|
The callback raised before the document is downloaded - from the toolbar, Ctrl+S or the Download method - to rename the file or cancel the download. |
| OnError |
EventCallback<string> |
|
The callback for when loading or rendering fails, with the error message. |
| OnFileOpened |
EventCallback<BitPdfSource> |
|
The callback for when the reader picks a file with the toolbar's open-file button, with the source built from it. Handle it to drive Source yourself; when unset the viewer opens the file on its own. |
| OnPageChanged |
EventCallback<int> |
|
The callback for when the focused page changes (with the 1-based page number). |
| OnPageRendered |
EventCallback<int> |
|
The callback for when a page has been rendered into the document surface, with its 1-based page number. Lazy rendering means this is raised as the reader reaches a page, not once per page up front. |
| OnPasswordRequested |
Func<Task<string?>>? |
null |
Invoked when an encrypted document needs a password. Return the password to retry, or null/empty to cancel. When unset, the viewer's own password dialog asks instead (see ShowPasswordPrompt). |
| OnPrinting |
EventCallback<BitPdfPrintArgs> |
|
The callback raised before the document is printed - from the toolbar, Ctrl+P or a Print method - with the page range, to cancel the print. |
| OnProgress |
EventCallback<double> |
|
The callback for the download progress of a URL source, as a fraction from 0 to 1. Only raised when the server declares a content length (which is also when the loading bar shows the progress); a chunked response has no total to report against. Range loading uses an indeterminate bar and only raises this event during buffered fallback. |
| OnRotationChanged |
EventCallback<int> |
|
The callback for when the page rotation changes, with the new angle in degrees (0, 90, 180 or 270). |
| OnSidebarChanged |
EventCallback<BitPdfSidebar> |
|
The callback for when the open side panel changes. |
| OnWarnings |
EventCallback<IReadOnlyList<string>> |
|
The callback raised after a document loads with any non-fatal diagnostics (e.g. a damaged file whose cross-reference table had to be rebuilt). |
| OnZoomChanged |
EventCallback<double> |
|
The callback for when the zoom factor changes (1 means 100%), whatever caused it: the toolbar, a fit mode, Ctrl+wheel or the public API. |
| RenderMode |
BitPdfRenderMode |
BitPdfRenderMode.Html |
How page content is painted. Canvas replays a display list onto a per-page canvas, while Html (the default) renders prerenderable positioned DOM. |
| RespectPermissions |
bool |
false |
Whether the document's own user access permissions are enforced. With it set, a document that forbids printing or copying has the corresponding toolbar control disabled, Print and Download refuse, and its text cannot be selected. Off by default, as in every browser pdf viewer: the flags are advisory, not a security boundary. |
| Rotation |
int |
0 |
The rotation applied to every page, in degrees, two-way bindable. Assigned values are normalized to the nearest quarter turn (0, 90, 180 or 270). |
| ScrollMode |
BitPdfScrollMode |
BitPdfScrollMode.Vertical |
How the pages are laid out on the scrollable surface: stacked vertically (the default), side by side on one horizontally scrolling row, wrapped into rows that fill the width, or one page (or spread) at a time. |
| ShowPasswordPrompt |
bool |
true |
Whether the viewer asks for the password of an encrypted document with a dialog of its own. Ignored when OnPasswordRequested is set, which takes over the asking. Set to false to let a password failure surface through OnError instead. |
| ShowToolbar |
bool |
true |
Whether the toolbar is shown. |
| Source |
BitPdfSource? |
null |
The document to display. |
| SpreadMode |
BitPdfSpreadMode |
BitPdfSpreadMode.None |
How pages are paired into spreads, the way a printed book falls open. |
| Strings |
BitPdfViewerStrings? |
null |
The strings of the viewer UI. Defaults to English; assign an instance with the properties you want to override to localize the toolbar, the sidebars and the status messages. |
| Styles |
BitPdfViewerClassStyles? |
null |
Custom CSS styles for the different parts of the viewer. |
| TextCoalescing |
BitPdfTextCoalescing |
BitPdfTextCoalescing.Exact |
How painted text is emitted. Compact merges same-line, same-style runs into one span per visual line (far fewer DOM nodes on per-glyph pdfs). |
| ToolbarEndTemplate |
RenderFragment<BitPdfViewer>? |
null |
Custom content rendered at the end of the toolbar, after the built-in controls. The context is the viewer itself. |
| ToolbarItems |
BitPdfToolbarItems |
BitPdfToolbarItems.All |
Which controls the toolbar offers. Combine the flags to build a reduced toolbar (e.g. navigation and zoom only). |
| ToolbarStartTemplate |
RenderFragment<BitPdfViewer>? |
null |
Custom content rendered at the start of the toolbar, before the built-in controls. The context is the viewer itself, so the content can drive it through its public API. |
| Width |
string? |
null |
The CSS width of the viewer (sets --bit-PdfViewer-width on the instance). When not set, the viewer fills the width its host gives it. |
| Zoom |
double |
1 |
The zoom factor (1 means 100%), two-way bindable. Assigning it switches the viewer to Custom zoom mode and clamps the value to MinZoom..MaxZoom. |
| ZoomPresets |
IEnumerable<double>? |
null |
The explicit zoom factors the toolbar's zoom dropdown offers (1 means 100%). Values outside MinZoom..MaxZoom are dropped. Defaults to 50%, 75%, 100%, 125%, 150%, 200%, 300% and 400%. |
| ZoomStep |
double |
1.2 |
The multiplier applied by ZoomIn and ZoomOut (and by the toolbar's zoom buttons), i.e. 20% a step by default. |
| Name |
Type |
Default value |
Description |
|---|
| Attachments |
IReadOnlyList<BitPdfAttachment> |
|
The files embedded in the document (the /EmbeddedFiles name tree plus any /FileAttachment annotation), empty when it carries none. Deferred Range data returns null/empty (false for flags); await LoadDocumentDetailsAsync when needed. |
| CurrentCursorTool |
BitPdfCursorTool |
|
What dragging on the document surface currently does. |
| CurrentScrollMode |
BitPdfScrollMode |
|
The current page layout on the scrollable surface. |
| CurrentSpreadMode |
BitPdfSpreadMode |
|
The current spread pairing. |
| Document |
BitPdfDocument? |
|
The parsed document model, or null when nothing is loaded. Exposes the full engine surface (catalog, pages, cross-reference table). With a stream source these objects and raw-file streams are valid only during that viewer load; released access throws ObjectDisposedException. Use the async viewer helpers for server rendering and text extraction. |
| FailedPages |
IReadOnlyList<int> |
|
The 1-based numbers of the pages whose rendering failed, in ascending order. Such a page shows an error note in place of its content and is not retried; a reload, rotation or render-mode change gives every page a fresh attempt. |
| FileSize |
long |
|
The size in bytes of the loaded document, or 0 when nothing is loaded. |
| FormFields |
IReadOnlyList<BitPdfFormField> |
|
The interactive form fields (/AcroForm) of the loaded document as a flat list of name/type/value, or an empty list when there is no form. Deferred stream or Range data returns an empty list; await LoadDocumentDetailsAsync when needed. |
| HasAttachments |
bool |
|
Whether the document carries any embedded file. Deferred Range data returns null/empty (false for flags); await LoadDocumentDetailsAsync when needed. |
| HasLayers |
bool |
|
Whether the document declares any optional-content group (layer). Deferred Range data returns null/empty (false for flags); await LoadDocumentDetailsAsync when needed. |
| HasOutline |
bool |
|
Whether the document exposes any bookmarks. Deferred Range data returns null/empty (false for flags); await LoadDocumentDetailsAsync when needed. |
| IsEncrypted |
bool |
|
Whether the loaded document declares an encryption dictionary. |
| IsFullscreen |
bool |
|
Whether the viewer currently fills the screen. |
| IsPresenting |
bool |
|
Whether the viewer is in presentation mode: fullscreen, one page at a time, scaled to fit, with the chrome out of the way. |
| IsSearchOpen |
bool |
|
Whether the find box is open. |
| Layers |
IReadOnlyList<BitPdfLayer> |
|
The optional-content groups (layers) the document declares, empty when it declares none. Deferred Range data returns null/empty (false for flags); await LoadDocumentDetailsAsync when needed. |
| Metadata |
BitPdfMetadata? |
|
The document metadata (/Info fields plus the raw XMP packet), or null when nothing is loaded. Deferred Range data returns null/empty (false for flags); await LoadDocumentDetailsAsync when needed. |
| Outline |
IReadOnlyList<BitPdfOutlineItem> |
|
The document outline (bookmarks) as a tree, empty when the document has none. Deferred Range data returns null/empty (false for flags); await LoadDocumentDetailsAsync when needed. |
| PageCount |
int |
|
The number of pages of the current document. |
| PageLabels |
IReadOnlyList<string> |
|
The document-defined page labels, one per page in document order. Deferred Range labels return an empty list; await LoadDocumentDetailsAsync when needed. |
| PdfVersion |
string? |
|
The pdf version the loaded document declares (e.g. "1.7"), or null. |
| Permissions |
BitPdfPermissions |
|
The user access permissions of the loaded document. Every permission is granted for an unencrypted document, and for no document at all. |
| SearchHighlightAll |
bool |
|
Whether the find box paints every match, not just the current one. |
| SearchMatchCase |
bool |
|
Whether the find box compares case-sensitively. |
| SearchMatchDiacritics |
bool |
|
Whether the find box tells an accented letter apart from its bare form. |
| SearchMatchIndex |
int |
|
The 1-based ordinal of the find match the reader is on, or 0 when there is no match. |
| SearchQuery |
string |
|
The current find query, or an empty string when nothing is being searched for. |
| SearchWholeWord |
bool |
|
Whether the find box matches whole words only. |
| SearchMatchCount |
int |
|
The number of matches of the current find query, counted over the whole document (0 when there is no query or no match). |
| Sidebar |
BitPdfSidebar |
|
Which side panel is currently open. |
| StructureTree |
IReadOnlyList<BitPdfStructElement> |
|
The tagged-pdf logical structure tree of the loaded document, or an empty list when the document is untagged. Deferred stream or Range data returns an empty list; await LoadDocumentDetailsAsync when needed. |
| Warnings |
IReadOnlyList<string> |
|
The non-fatal diagnostics collected while the current document was parsed (e.g. a damaged cross-reference table that had to be rebuilt), empty when there were none or nothing is loaded. |
| ZoomMode |
BitPdfZoomMode |
|
The current zoom behavior (fit-width, fit-page, actual size or custom). |
| ClearSearch |
Task ClearSearch() |
|
Clears the current find query and its highlights. |
| DownloadAttachment |
Task DownloadAttachment(BitPdfAttachment attachment) |
|
Saves an embedded file to the reader's machine. |
| Download |
Task Download() |
|
Downloads original bytes, reusing fetched URL buffers or streaming from a seekable source without retaining a complete server buffer. OnDownloading runs first and may rename or cancel it. |
| ClearSelection |
Task ClearSelection() |
|
Drops the reader's selection inside the document. A selection made elsewhere on the hosting page is left alone. |
| GetSelectedText |
Task<string> GetSelectedText() |
|
The text the reader currently has selected in the document, or an empty string when nothing inside the viewer is selected. Reads the live DOM selection over the page's text layer, so it is the words the reader sees, in reading order. |
| ExtractPageTextAsync |
Task<string> ExtractPageTextAsync(int pageNumber, CancellationToken cancellationToken = default) |
|
Extracts one page's text without blocking server stream reads on the circuit. |
| ExtractPageText |
string ExtractPageText(int pageNumber) |
|
Extracts the visible text of a single page (1-based) for search or copy, or an empty string when unavailable. Throws InvalidOperationException for an active stream or Range source; use ExtractPageTextAsync. |
| ExtractTextAsync |
Task<string> ExtractTextAsync(string pageSeparator = "\n\n", CancellationToken cancellationToken = default) |
|
Extracts all page text asynchronously and reuses the viewer's text index. |
| ExtractText |
string ExtractText(string pageSeparator = "\n\n") |
|
Extracts the visible text of the whole document, one page per entry joined by the separator. Reuses the index the find box builds. Throws InvalidOperationException for an active stream or Range source; use ExtractTextAsync. |
| IsLayerVisible |
bool IsLayerVisible(BitPdfLayer layer) |
|
Whether the layer is currently painted. |
| SetLayerVisible |
Task SetLayerVisible(BitPdfLayer layer, bool visible) |
|
Shows or hides an optional-content group and re-renders the pages, the way a desktop viewer's layers panel does. |
| FindNext |
Task FindNext() |
|
Moves to the next find match, wrapping around at the end. |
| FindPrevious |
Task FindPrevious() |
|
Moves to the previous find match, wrapping around at the start. |
| FirstPage |
Task FirstPage() |
|
Navigates to the first page. |
| LoadDocumentDetailsAsync |
Task LoadDocumentDetailsAsync(CancellationToken cancellationToken = default) |
|
Loads all deferred document details. Range properties return null/empty until populated; form fields and structure are also deferred for seekable streams. Buffered sources complete immediately. |
| GetBytesAsync |
Task<byte[]?> GetBytesAsync(CancellationToken cancellationToken = default) |
|
Returns the existing buffered array, or explicitly copies a stream or Range source to a complete caller-owned array. The viewer does not retain the copy; GetBytes stays null for non-buffered sources. |
| GetBytes |
byte[]? GetBytes() |
|
The raw bytes of a buffered document (fetched ones included), or null for a stream or Range source or when nothing is loaded. Use GetBytesAsync for an explicit copy. |
| GoToDestination |
Task GoToDestination(BitPdfDestination? destination) |
|
Navigates to a destination: its page, and - when the destination names a vertical position - that position within the page, whatever the rotation. A destination that names a zoom applies it too. |
| GoToNamedDestination |
Task GoToNamedDestination(string name) |
|
Navigates to a named destination (the /Dests entry a link or an external anchor refers to). Does nothing when the document does not declare it. |
| GoToPage |
Task GoToPage(int pageNumber) |
|
Navigates to the provided page number (1-based). |
| LastPage |
Task LastPage() |
|
Navigates to the last page. |
| NextPage |
Task NextPage() |
|
Navigates to the next page. |
| PrevPage |
Task PrevPage() |
|
Navigates to the previous page. |
| OpenAsync |
Task OpenAsync(BitPdfSource? source) |
|
Loads a document without going through the Source parameter. Passing null closes the current one. The Source parameter still wins: a later host render that changes it replaces whatever was opened this way. |
| PrintCurrentPage |
Task PrintCurrentPage() |
|
Opens the browser print dialog with just the page the reader is on. |
| Print |
Task Print() |
|
Opens the browser print dialog with all pages of the document. An overload takes a page range: Print(int from, int to). OnPrinting runs first and may cancel it. |
| RenderPageHtmlAsync |
Task<string> RenderPageHtmlAsync(int pageNumber, CancellationToken cancellationToken = default) |
|
Renders a page asynchronously, with server stream work off the circuit. Cancellation or document replacement discards the result. |
| RenderPageHtml |
string RenderPageHtml(int pageNumber) |
|
Renders a single page (1-based) to self-contained HTML, or an empty string when no document is loaded or the number is out of range. Throws InvalidOperationException for an active stream or Range source; use RenderPageHtmlAsync. |
| RotateClockwise |
Task RotateClockwise() |
|
Rotates all pages 90 degrees clockwise. |
| RotateCounterClockwise |
Task RotateCounterClockwise() |
|
Rotates all pages 90 degrees counter-clockwise. |
| Search |
Task Search(string? query) |
|
Opens the find box (when it is closed) and searches the document for the query. An empty query just clears the current matches. |
| SetSearchOptions |
Task SetSearchOptions(bool? matchCase, bool? wholeWord, bool? matchDiacritics, bool? highlightAll) |
|
Sets the find options and re-runs the current query against them. A null leaves that option as it is. |
| SetRotation |
Task SetRotation(int degrees) |
|
Rotates all pages to the given absolute angle in degrees, normalized to the nearest quarter turn. |
| SetCursorTool |
void SetCursorTool(BitPdfCursorTool tool) |
|
Changes what dragging on the document surface does. |
| SetScrollMode |
Task SetScrollMode(BitPdfScrollMode mode) |
|
Changes how the pages are laid out on the scrollable surface. |
| SetSpreadMode |
Task SetSpreadMode(BitPdfSpreadMode mode) |
|
Changes how pages are paired into spreads. |
| SetZoom |
Task SetZoom(double zoom) |
|
Sets an explicit zoom factor (1 means 100%), switching the viewer to Custom zoom mode. The value is clamped to MinZoom..MaxZoom. |
| SetZoomMode |
Task SetZoomMode(BitPdfZoomMode mode) |
|
Sets the zoom mode (fit-width, fit-page, actual size or custom). |
| ShowSidebar |
Task ShowSidebar(BitPdfSidebar sidebar) |
|
Opens the given side panel, or closes the open one when None is passed. |
| EnterPresentationMode |
Task EnterPresentationMode() |
|
Shows the document fullscreen, one page at a time, scaled to fit the screen. |
| ExitPresentationMode |
Task ExitPresentationMode() |
|
Leaves presentation mode and restores the layout it replaced. |
| TogglePresentationMode |
Task TogglePresentationMode() |
|
Enters or leaves presentation mode. Entering remembers the layout the reader had, so leaving - however it happens, including the browser's own Escape - puts it back. |
| ToggleFullscreen |
Task ToggleFullscreen() |
|
Toggles the fullscreen mode of the viewer. |
| ToggleProperties |
void ToggleProperties() |
|
Opens or closes the document-properties dialog. |
| ZoomIn |
Task ZoomIn() |
|
Zooms in by one ZoomStep (20% by default). |
| ZoomOut |
Task ZoomOut() |
|
Zooms out by one ZoomStep (20% by default). |