New to Telerik UI for BlazorStart a free 30-day trial

Telerik PDF Viewer component for displaying, navigating, and interacting with PDF documents in Blazor applications. Provides comprehensive PDF viewing capabilities including zoom controls, page navigation, text search, form interactions, and annotation tools. Supports file loading from byte arrays, user uploads, and drag-and-drop functionality with customizable toolbars and responsive design.

Definition

Constructors

C#
public TelerikPdfViewer()

Methods

C#
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters:__builderRenderTreeBuilder

Overrides: ComponentBase.BuildRenderTree(RenderTreeBuilder)

C#
public override void Dispose()

Overrides: BaseComponent.Dispose()

Gets the PDF file data as a byte array, including any annotations or form filling changes.

C#
public Task<byte[]> GetFileAsync()
Returns:

Task<byte[]>

A task that represents the asynchronous operation. The task result contains the PDF data as a byte array, or null if no document is loaded.

C#
protected Task InitJsComponentAsync()
Returns:

Task

C#
protected override Task OnAfterRenderAsync(bool firstRender)
Parameters:firstRenderboolReturns:

Task

Overrides: BaseComponent.OnAfterRenderAsync(bool)

C#
protected override Task OnParametersSetAsync()
Returns:

Task

Overrides: ComponentBase.OnParametersSetAsync()

Prints the loaded PDF file.

C#
public void Print()

Updates the component and processes the latest file data.

C#
public void Rebind()
C#
public override Task SetParametersAsync(ParameterView parameters)
Parameters:parametersParameterViewReturns:

Task

Overrides: ComponentBase.SetParametersAsync(ParameterView)

Properties

Controls how PDF forms and interactive elements are rendered and whether users can interact with them. Disable shows no form fields - use for read-only viewing of documents with forms. Enable displays form fields as read-only - use to show form data without allowing editing. EnableForms renders interactive, editable forms - use when users need to fill out and modify form fields. Supports TextBox, CheckBox, DropDown, RadioButton, and Button form elements when enabled. Default is Enable.

C#
[Parameter]
public PdfViewerAnnotationMode AnnotationMode { get; set; }

Children: Customize the PDF Viewer with toolbar tools, search panels, and annotation toolbars. Add PdfViewerToolBar for custom toolbars or modify the default toolbar appearance and functionality.

C#
[Parameter]
public RenderFragment ChildContent { get; set; }

Loads PDF document content from a byte array for viewing and interaction. Provide the PDF file data as a byte array to display documents loaded from databases, web services, or local storage. When null or empty, the component displays a blank page with file upload options.

C#
[Parameter]
public byte[] Data { get; set; }
C#
[CascadingParameter]
protected DialogFactory DialogFactory { get; set; }

Controls whether a loading indicator appears during long-running operations like file loading or rendering. When true (default), users see a loader during PDF processing operations, improving user experience. Set to false to hide loading indicators if you prefer to implement custom loading states.

C#
[Parameter]
public bool EnableLoaderContainer { get; set; }

Controls the component height using any valid CSS unit like "100%", "600px", or "80vh". Set this to define the viewing area for PDF documents and enable proper scrolling behavior. When not specified, the component uses its default size based on content. Required for: Page navigation with PdfViewerToolBarPagerTool (enables automatic scrolling), print functionality with PdfViewerToolBarPrintTool (proper document paging).

C#
[Parameter]
public string Height { get; set; }

Sets the maximum zoom level for document viewing, preventing users from zooming in beyond this limit. Use values like 2.0m (200%) for moderate zoom or 5.0m (500%) for detailed inspection of document content. Must be greater than MinZoom - invalid ranges will cause unexpected behavior. Works with ZoomRate to control zoom step increments and Zoom for current level. Default is 4.0m (400%).

C#
[Parameter]
public decimal MaxZoom { get; set; }

Sets the minimum zoom level for document viewing, preventing users from zooming out beyond this limit. Use values like 0.25m (25%) for extensive zoom-out or 0.5m (50%) for moderate minimum zoom. Must be less than MaxZoom - invalid ranges will cause unexpected behavior. Works with ZoomRate to control zoom step increments and Zoom for current level. Default is 0.5m (50%).

C#
[Parameter]
public decimal MinZoom { get; set; }

Fires when a user initiates a PDF download through the toolbar download button. Use this event to customize the download behavior, modify the filename, or track download actions. The event args contain the filename and can be cancelled to prevent the download.

C#
[Parameter]
public EventCallback<PdfViewerDownloadEventArgs> OnDownload { get; set; }

Fires when errors occur during PDF loading, rendering, or other operations. Use this event to handle error scenarios gracefully, show user-friendly error messages, or log errors for debugging. The event args contain the error message describing what went wrong.

C#
[Parameter]
public EventCallback<PdfViewerErrorEventArgs> OnError { get; set; }

Fires when a user opens a PDF file through the file upload interface or drag-and-drop functionality. Use this event to validate file types, implement custom file processing, or track file opening actions. The event args contain file information and can be cancelled to prevent the file from loading.

C#
[Parameter]
public EventCallback<PdfViewerOpenEventArgs> OnOpen { get; set; }

Controls the rendering quality and memory usage for PDF document display with direct impact on performance. Higher values like 4.0 or 5.0 produce sharper text and graphics but consume significantly more memory and processing power. Lower values like 1.0 or 2.0 improve performance and reduce memory usage but may result in less crisp rendering, especially when zoomed. Use 3.0 (default) for balanced quality and performance, or adjust based on your application's performance requirements and target devices. Critical considerations: High-DPI displays benefit from higher values, mobile devices may require lower values, large documents need careful balance. Interacts with Zoom levels - higher zoom with high render scale can impact browser performance significantly.

C#
[Parameter]
public double RenderScale { get; set; }

Controls the component width using any valid CSS unit like "100%", "400px", or "50em". Set this to ensure the PDF Viewer fits your layout design. When not specified, the component uses its default size based on content.

C#
[Parameter]
public string Width { get; set; }

Gets or sets the current zoom level for the PDF document display. Use values like 0.5m (50%) to fit more content, 1.0m (100%) for normal size, or 2.0m (200%) for magnified viewing. The value is automatically constrained between MinZoom and MaxZoom. Accepts a decimal ratio (e.g., 1.0m for 100%, 2.0m for 200%) or a PdfViewerZoomLevelType enum value (e.g., FitToPage). Bind this property to enable two-way data binding with zoom controls.

C#
[Parameter]
public object Zoom { get; set; }

Fires when the zoom level changes through user interaction or programmatic updates. Use this event to synchronize zoom values with external controls or track user zoom behavior. The event provides the resolved numeric zoom level as a decimal value (e.g., 1.25m for 125%) wrapped in an object.

C#
[Parameter]
public EventCallback<object> ZoomChanged { get; set; }

Controls the increment/decrement step when users zoom in or out using toolbar buttons or keyboard shortcuts. Use values like 0.1m (10%) for fine control or 0.5m (50%) for faster zoom changes. This determines how much the zoom level changes with each zoom action relative to MinZoom and MaxZoom bounds. Works with zoom tools in PdfViewerToolBarZoomTool for consistent user experience. Default is 0.25m (25%).

C#
[Parameter]
public decimal ZoomRate { get; set; }