ClassTelerikPdfViewer
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:
public class TelerikPdfViewer : BaseComponent, IComponent, IHandleEvent, IHandleAfterRender, IDisposable
Inheritance: objectComponentBaseBaseComponentTelerikPdfViewer
Implements:
Inherited Members
Constructors
TelerikPdfViewer()
Declaration
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
[Parameter]
public PdfViewerAnnotationMode AnnotationMode { get; set; }
Property Value
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
[Parameter]
public RenderFragment ChildContent { get; set; }
Property Value
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.
DialogFactory
Declaration
[CascadingParameter]
protected DialogFactory DialogFactory { get; set; }
Property Value
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
[Parameter]
public bool EnableLoaderContainer { get; set; }
Property Value
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).
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
[Parameter]
public decimal MaxZoom { get; set; }
Property Value
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
[Parameter]
public decimal MinZoom { get; set; }
Property Value
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
[Parameter]
public EventCallback<PdfViewerDownloadEventArgs> OnDownload { get; set; }
Property Value
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
[Parameter]
public EventCallback<PdfViewerErrorEventArgs> OnError { get; set; }
Property Value
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
[Parameter]
public EventCallback<PdfViewerOpenEventArgs> OnOpen { get; set; }
Property Value
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
[Parameter]
public double RenderScale { get; set; }
Property Value
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.
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.
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
[Parameter]
public EventCallback<decimal> ZoomChanged { get; set; }
Property Value
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
[Parameter]
public decimal ZoomRate { get; set; }
Property Value
Methods
BuildRenderTree(RenderTreeBuilder)
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
__builder
Overrides
Dispose()
Declaration
public override void Dispose()
Overrides
GetFileAsync()
Gets the PDF file data as a byte array, including any annotations or form filling changes.
Rebind()
Updates the component and processes the latest file data.
Declaration
public void Rebind()
SetParametersAsync(ParameterView)
Declaration
public override Task SetParametersAsync(ParameterView parameters)
Parameters
parameters
Returns
Overrides