Blazorise PdfViewer: API Reference

Explore the Blazorise PdfViewer API reference for documents, navigation events, toolbar components, and methods.

The PdfViewer API covers document loading, page navigation, zooming, toolbar customization, and programmatic viewer control.

API

Parameters

PdfViewer

ParameterDefaultType
ChildContentnullRenderFragment

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.
DownloadFileNamePromptOptionsnew()PdfDownloadFileNamePromptOptions

Defines options for customizing the default modal download filename prompt.
ModeSinglePagePdfViewerMode

Specifies how PDF pages are displayed. The default value is SinglePage.
Possible values:SinglePageContinuous
OrientationPortraitPdfOrientation

Specifies the orientation of the PDF document. The default value is Portrait.
Possible values:PortraitLandscape
PageNumber1int

Specifies the current page number of the PDF document. The default value is 1.
PasswordPromptOptionsnew()PdfPasswordPromptOptions

Defines options for customizing the default modal password prompt.
Scale1double

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

Determines whether the default modal prompt should be used when DownloadFileNameRequested is not provided.
UseModalPasswordPrompttruebool

Determines whether the default modal prompt should be used when PasswordRequested is not provided.

PdfViewerContainer

ParameterDefaultType
ChildContentnullRenderFragment

Defines the content to be rendered inside the component.
This property allows developers to define custom content within the PDF container component.

PdfViewerToolbar

ParameterDefaultType
ShowDownloadingtruebool

Specifies if the download button should be displayed.
ShowPagingtruebool

Specifies if the paging buttons should be displayed.
ShowPrintingtruebool

Specifies if the print button should be displayed.
ShowZoomingtruebool

Specifies if the zoom buttons should be displayed.

Events

PdfViewer

EventType
DownloadCanceledEventCallback

Notifies when the download filename request is canceled.
DownloadFileNameRequestedFunc<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.
DownloadRequestedEventCallback

Notifies when downloading is requested for the PDF document.
LoadedEventCallback<PdfLoadedEventArgs>

Notifies when the PDF document finishes loading.
PageNumberChangedEventCallback<int>

Notifies when the current page number changes.
PasswordCanceledEventCallback

Notifies when the password request is canceled.
PasswordRequestedFunc<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.
PrintRequestedEventCallback

Notifies when printing is requested for the PDF document.
ScaleChangedEventCallback<double>

Notifies when the zoom scale changes.

Methods

PdfViewer

MethodReturnParameters
DownloadTask—

Downloads the currently loaded PDF document.
GoToPageTaskint pageNumber

Navigates to the specified page number in the PDF document.
NextPageTask—

Navigates to the next page of the PDF document.
PreviousPageTask—

Navigates to the previous page of the PDF document.
PrintTask—

Prints the currently loaded PDF document.
SetScaleTaskdouble scale

Sets the scale factor for displaying the PDF document.