Class
TelerikPdfViewer

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

Namespace:Telerik.Blazor.Components

Assembly:Telerik.Blazor.dll

Syntax:

cs-api-definition
public class TelerikPdfViewer : BaseComponent, IComponent, IHandleEvent, IHandleAfterRender, IDisposable

Inheritance: objectComponentBaseBaseComponentTelerikPdfViewer

Implements: IComponentIDisposableIHandleAfterRenderIHandleEvent

Inherited Members BaseComponent.ShouldRender()BaseComponent.OnInitializedAsync()BaseComponent.InitLocalizer()BaseComponent.ThrowIfParameterIsNull(object, string)BaseComponent.HaveOptionsChanged(IDictionary<string, object>, IDictionary<string, object>)BaseComponent.GetClassString(params string[])BaseComponent.InvokeAsync<T>(string, params object[])BaseComponent.InvokeAsync<T>(string, CancellationToken, params object[])BaseComponent.InvokeVoidAsync(string, params object[])BaseComponent.InvokeComponentMethodAsync<T>(string, params object[])BaseComponent.InvokeComponentMethodAsync<T>(string, CancellationToken, params object[])BaseComponent.InvokeVoidComponentMethodAsync(string, params object[])BaseComponent.InvokeComponentVoidMethodAsync(string, object)BaseComponent.InvokeDisposeAsync()BaseComponent.StateHasChanged()BaseComponent.RootComponentBaseComponent.ClassComponentBase.OnInitialized()ComponentBase.OnParametersSet()ComponentBase.OnAfterRender(bool)ComponentBase.InvokeAsync(Action)ComponentBase.InvokeAsync(Func<Task>)ComponentBase.DispatchExceptionAsync(Exception)

Constructors

TelerikPdfViewer()

Declaration

cs-api-definition
public TelerikPdfViewer()

Properties

AnnotationMode

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.

Declaration

cs-api-definition
[Parameter]
public PdfViewerAnnotationMode AnnotationMode { get; set; }

Property Value

PdfViewerAnnotationMode

ChildContent

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.

Declaration

cs-api-definition
[Parameter]
public RenderFragment ChildContent { get; set; }

Property Value

RenderFragment

Data

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.

Declaration

cs-api-definition
[Parameter]
public byte[] Data { get; set; }

Property Value

byte[]

DialogFactory

Declaration

cs-api-definition
[CascadingParameter]
protected DialogFactory DialogFactory { get; set; }

Property Value

DialogFactory

EnableLoaderContainer

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.

Declaration

cs-api-definition
[Parameter]
public bool EnableLoaderContainer { get; set; }

Property Value

bool

Height

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

Declaration

cs-api-definition
[Parameter]
public string Height { get; set; }

Property Value

string

MaxZoom

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%).

Declaration

cs-api-definition
[Parameter]
public decimal MaxZoom { get; set; }

Property Value

decimal

MinZoom

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%).

Declaration

cs-api-definition
[Parameter]
public decimal MinZoom { get; set; }

Property Value

decimal

OnDownload

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.

Declaration

cs-api-definition
[Parameter]
public EventCallback<PdfViewerDownloadEventArgs> OnDownload { get; set; }

Property Value

EventCallback<PdfViewerDownloadEventArgs>

OnError

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.

Declaration

cs-api-definition
[Parameter]
public EventCallback<PdfViewerErrorEventArgs> OnError { get; set; }

Property Value

EventCallback<PdfViewerErrorEventArgs>

OnOpen

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.

Declaration

cs-api-definition
[Parameter]
public EventCallback<PdfViewerOpenEventArgs> OnOpen { get; set; }

Property Value

EventCallback<PdfViewerOpenEventArgs>

RenderScale

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.

Declaration

cs-api-definition
[Parameter]
public double RenderScale { get; set; }

Property Value

double

Width

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.

Declaration

cs-api-definition
[Parameter]
public string Width { get; set; }

Property Value

string

Zoom

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. Bind this property to enable two-way data binding with zoom controls.

Declaration

cs-api-definition
[Parameter]
public decimal Zoom { get; set; }

Property Value

decimal

ZoomChanged

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 new zoom level as a decimal value (e.g., 1.25m for 125%).

Declaration

cs-api-definition
[Parameter]
public EventCallback<decimal> ZoomChanged { get; set; }

Property Value

EventCallback<decimal>

ZoomRate

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%).

Declaration

cs-api-definition
[Parameter]
public decimal ZoomRate { get; set; }

Property Value

decimal

Methods

BuildRenderTree(RenderTreeBuilder)

Declaration

cs-api-definition
protected override void BuildRenderTree(RenderTreeBuilder __builder)

Parameters

__builder

RenderTreeBuilder

Overrides ComponentBase.BuildRenderTree(RenderTreeBuilder)

Dispose()

Declaration

cs-api-definition
public override void Dispose()

Overrides BaseComponent.Dispose()

GetFileAsync()

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

Declaration

cs-api-definition
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.

InitJsComponentAsync()

Declaration

cs-api-definition
protected Task InitJsComponentAsync()

Returns

Task

OnAfterRenderAsync(bool)

Declaration

cs-api-definition
protected override Task OnAfterRenderAsync(bool firstRender)

Parameters

firstRender

bool

Returns

Task

Overrides BaseComponent.OnAfterRenderAsync(bool)

OnParametersSetAsync()

Declaration

cs-api-definition
protected override Task OnParametersSetAsync()

Returns

Task

Overrides ComponentBase.OnParametersSetAsync()

Print()

Prints the loaded PDF file.

Declaration

cs-api-definition
public void Print()

Rebind()

Updates the component and processes the latest file data.

Declaration

cs-api-definition
public void Rebind()

SetParametersAsync(ParameterView)

Declaration

cs-api-definition
public override Task SetParametersAsync(ParameterView parameters)

Parameters

parameters

ParameterView

Returns

Task

Overrides ComponentBase.SetParametersAsync(ParameterView)