Blazorise PdfViewer: API Reference
Explore the Blazorise PdfViewer API reference for documents, navigation events, toolbar components, and methods.
For examples and details on the usage of this component, visit the example page: PdfViewer
The PdfViewer API covers document loading, page navigation, zooming, toolbar customization, and programmatic viewer control.
API
Parameters
PdfViewer
| Parameter | Default | Type |
|---|---|---|
ChildContent | null | RenderFragment |
Defines the content to be rendered inside the component. This property allows developers to define custom content within the PDF viewer component. | ||
DownloadFileName | — | string |
Specifies an explicit filename used when downloading the PDF document. If not provided, the filename is resolved from PDF metadata title or source. | ||
DownloadFileNamePromptOptions | new() | PdfDownloadFileNamePromptOptions |
Defines options for customizing the default modal download filename prompt. | ||
Mode | SinglePage | PdfViewerMode |
Specifies how PDF pages are displayed. The default value is SinglePage. Possible values: SinglePageContinuous | ||
Orientation | Portrait | PdfOrientation |
Specifies the orientation of the PDF document. The default value is Portrait. Possible values: PortraitLandscape | ||
PageNumber | 1 | int |
Specifies the current page number of the PDF document. The default value is 1. | ||
PasswordPromptOptions | new() | PdfPasswordPromptOptions |
Defines options for customizing the default modal password prompt. | ||
Scale | 1 | double |
Specifies the scale factor for displaying the PDF document. The default value is 1, which represents the original size. | ||
Source | — | string |
Specifies the source URL or base64 formated string of the PDF document to be loaded. | ||
UseModalDownloadFileNamePrompt | false | bool |
Determines whether the default modal prompt should be used when DownloadFileNameRequested is not provided. | ||
UseModalPasswordPrompt | true | bool |
Determines whether the default modal prompt should be used when PasswordRequested is not provided. | ||
PdfViewerContainer
| Parameter | Default | Type |
|---|---|---|
ChildContent | null | RenderFragment |
Defines the content to be rendered inside the component. This property allows developers to define custom content within the PDF container component. | ||
PdfViewerToolbar
| Parameter | Default | Type |
|---|---|---|
ShowDownloading | true | bool |
Specifies if the download button should be displayed. | ||
ShowPaging | true | bool |
Specifies if the paging buttons should be displayed. | ||
ShowPrinting | true | bool |
Specifies if the print button should be displayed. | ||
ShowZooming | true | bool |
Specifies if the zoom buttons should be displayed. | ||
Events
PdfViewer
| Event | Type |
|---|---|
DownloadCanceled | EventCallback |
Notifies when the download filename request is canceled. | |
DownloadFileNameRequested | Func<PdfDownloadFileNameRequestedEventArgs, Task<string>> |
Provides a callback when a download filename is requested. If not set, the default modal prompt is used when UseModalDownloadFileNamePrompt is enabled. | |
DownloadRequested | EventCallback |
Notifies when downloading is requested for the PDF document. | |
Loaded | EventCallback<PdfLoadedEventArgs> |
Notifies when the PDF document finishes loading. | |
PageNumberChanged | EventCallback<int> |
Notifies when the current page number changes. | |
PasswordCanceled | EventCallback |
Notifies when the password request is canceled. | |
PasswordRequested | Func<PdfPasswordRequestedEventArgs, Task<string>> |
Provides a callback when a password is required to open a protected PDF document. If not set, a default modal prompt is shown when UseModalPasswordPrompt is enabled. | |
PrintRequested | EventCallback |
Notifies when printing is requested for the PDF document. | |
ScaleChanged | EventCallback<double> |
Notifies when the zoom scale changes. | |
Methods
PdfViewer
| Method | Return | Parameters |
|---|---|---|
Download | Task | — |
Downloads the currently loaded PDF document.
| ||
GoToPage | Task | int pageNumber |
Navigates to the specified page number in the PDF document.
| ||
NextPage | Task | — |
Navigates to the next page of the PDF document.
| ||
PreviousPage | Task | — |
Navigates to the previous page of the PDF document.
| ||
Print | Task | — |
Prints the currently loaded PDF document.
| ||
SetScale | Task | double scale |
Sets the scale factor for displaying the PDF document.
| ||