Class RadPdfViewer
Represents a control that can display and interact with PDF documents within your application. The RadPdfViewer provides comprehensive PDF viewing capabilities including zooming, scrolling, panning, and text search functionality. The control features a virtualized rendering engine to ensure optimal performance with large documents. It can be seamlessly integrated with a RadPdfViewerNavigator control to provide additional navigation features such as page thumbnails, bookmarks, and quick page selection.
Inherited Members
Namespace: Telerik.WinControls.UI
Assembly: Telerik.WinControls.PdfViewer.dll
Syntax
[TelerikToolboxCategory("PdfViewer")]
public class RadPdfViewer : RadControl, INotifyPropertyChanged, ISupportInitializeNotification, ISupportInitialize, IComponentTreeHandler, ILayoutHandler, IPCHost, IAnalyticsProvider, IPrintableConstructors
RadPdfViewer()
Creates a RadPdfViewer control.
Declaration
public RadPdfViewer()Properties
AnnotationsColor
Gets or sets the background color of the annotations when they are pressed.
Declaration
public Color AnnotationsColor { get; set; }Property Value
| System.Drawing.Color 
 | 
AutoSize
Declaration
public override bool AutoSize { get; set; }Property Value
| System.Boolean 
 | 
Overrides
BackColor
RadPdfViewer consists of multiple visual elements and separate settings are provided to customize their appearance. Current BackColor property might be ignored.
Declaration
public override Color BackColor { get; set; }Property Value
| System.Drawing.Color 
 | 
Overrides
ContainerElement
Gets the RadPdfViewerContainer which represents the elements container of the control.
Declaration
public RadPdfViewerContainer ContainerElement { get; }Property Value
| RadPdfViewerContainer 
 | 
DefaultSize
Declaration
protected override Size DefaultSize { get; }Property Value
| System.Drawing.Size 
 | 
Document
Gets or Sets the currently loaded RadFixedDocument
Declaration
public RadFixedDocument Document { get; set; }Property Value
| RadFixedDocument 
 | 
EnableThumbnails
Gets or sets whether the thumbnail element is visible.
Declaration
public bool EnableThumbnails { get; set; }Property Value
| System.Boolean 
 | 
FitFullPage
Gets or sets whether a complete page should be fitted within the viewer control. When enabled, the zoom level automatically adjusts to display an entire page.
Declaration
public bool FitFullPage { get; set; }Property Value
| System.Boolean 
 | 
FitToWidth
Gets or sets whether the document should be scaled to fit the width of the viewer control. When enabled, the zoom level automatically adjusts when the control is resized.
Declaration
public bool FitToWidth { get; set; }Property Value
| System.Boolean 
 | 
ForeColor
RadPdfViewer consists of multiple visual elements and separate settings are provided to customize their appearance. Current ForeColor property might be ignored.
Declaration
public override Color ForeColor { get; set; }Property Value
| System.Drawing.Color 
 | 
Overrides
HorizontalScrollState
Gets or sets the display state of the horizontal scrollbar.
Declaration
public ScrollState HorizontalScrollState { get; set; }Property Value
| ScrollState 
 | 
PdfViewerElement
Gets the RadPdfViewerElement which represents the main element of the control.
Declaration
public RadPdfViewerElement PdfViewerElement { get; }Property Value
| RadPdfViewerElement 
 | 
PrintOrientation
Set or get the page orientation when printing.
Declaration
public PrintOrientation PrintOrientation { get; set; }Property Value
| PrintOrientation 
 | 
PrintScalePageToPaperSize
Scale page when printing to fit the paper size without keeping the aspect ratio.
Declaration
public bool PrintScalePageToPaperSize { get; set; }Property Value
| System.Boolean 
 | 
RadContextMenu
Gets or sets the associated RadContextMenu. By default this is PdfViewerContextMenu.
Declaration
public RadContextMenu RadContextMenu { get; set; }Property Value
| RadContextMenu 
 | 
ReadingMode
Gets or sets whether the entire document is loaded at the begining or pages are loaded on demand.
Declaration
public ReadingMode ReadingMode { get; set; }Property Value
| ReadingMode 
 | 
RotationAngle
Gets or sets the rotation angle applied to all pages in the document.
Declaration
public RotationAngle RotationAngle { get; set; }Property Value
| RotationAngle 
 | 
ScaleFactor
Gets or sets the factor by which the document is scaled.
Declaration
public float ScaleFactor { get; set; }Property Value
| System.Single 
 | 
SelectionColor
Gets or sets the color that highlights the current selection.
Declaration
public Color SelectionColor { get; set; }Property Value
| System.Drawing.Color 
 | 
Text
This property is not relevant for this class.
Declaration
public override string Text { get; set; }Property Value
| System.String 
 | 
Overrides
ThumbnailListWidth
Get or Set the width of the Thumbnail list
Declaration
public int ThumbnailListWidth { get; set; }Property Value
| System.Int32 
 | 
ThumbnailsScaleFactor
Declaration
public float ThumbnailsScaleFactor { get; set; }Property Value
| System.Single 
 | 
UseBufferedPrinting
if true, the page will be printed in an image that will be send to the printer at once. Loss of quality is possible.
Declaration
public bool UseBufferedPrinting { get; set; }Property Value
| System.Boolean 
 | 
UsePdfProcessingModel
The model from the PdfProcessing library is always used for rendering the PDF pages. As of R2 2023 setting this property will not have any effect. The property will be removed in R2 2024.
Declaration
[Obsolete("The model from the PdfProcessing library is always used for rendering the PDF pages. As of R2 2023 setting this property will not have any effect. The property will be removed in R2 2024.")]
public bool UsePdfProcessingModel { get; set; }Property Value
| System.Boolean 
 | 
UsePdfProcessingModelDefaultValue
The model from the PdfProcessing library is always used for rendering the PDF pages. As of R2 2023 setting this property will not have any effect.
Declaration
[Obsolete("The model from the PdfProcessing library is always used for rendering the PDF pages. As of R2 2023 setting this property will not have any effect. The property will be removed in R2 2024.")]
public static bool UsePdfProcessingModelDefaultValue { get; set; }Property Value
| System.Boolean 
 | 
VerticalScrollState
Gets or sets the display state of the vertical scrollbar.
Declaration
public ScrollState VerticalScrollState { get; set; }Property Value
| ScrollState 
 | 
ViewerMode
Gets or sets the current viewer mode - Pan, TextSelection or None.
Declaration
public FixedDocumentViewerMode ViewerMode { get; set; }Property Value
| FixedDocumentViewerMode 
 | 
Methods
CreateChildItems(RadElement)
Creates the child elements of the RadPdfViewer control.
Declaration
protected override void CreateChildItems(RadElement parent)Parameters
| RadElement
        parent The parent element to which child elements will be added. | 
Overrides
CreateContainerElement(RadPdfViewerElement)
Creates the container element that hosts the PDF viewer element.
Declaration
protected virtual RadPdfViewerContainer CreateContainerElement(RadPdfViewerElement ownerElement)Parameters
| RadPdfViewerElement
        ownerElement The PDF viewer element that will be contained. | 
Returns
| RadPdfViewerContainer A new instance of RadPdfViewerContainer. | 
CreateViewerElement()
Creates the PDF viewer element used for document visualization.
Declaration
protected virtual RadPdfViewerElement CreateViewerElement()Returns
| RadPdfViewerElement A new instance of RadPdfViewerElement. | 
ExportPage(Int32, Double, Boolean, ImageFormat)
Exports a single PDF page to a Bitmap object.
Declaration
public Bitmap ExportPage(int pageNumber, double aspectRatio, bool overrideFileIfAlreadyExist, ImageFormat imageFormat)Parameters
| System.Int32
        pageNumber Number of the page to export. First page has a number 1. A value of 0 means export the current page. | 
| System.Double
        aspectRatio Scale factor for the exported image. Value of 1.0 represents the original size. | 
| System.Boolean
        overrideFileIfAlreadyExist When true, overrides the image file if it already exists. | 
| System.Drawing.Imaging.ImageFormat
        imageFormat The image format to use when creating the bitmap. | 
Returns
| System.Drawing.Bitmap Returns a Bitmap object representing the PDF page. This bitmap should be disposed manually when no longer needed. | 
ExportPage(Int32, String, Double, Boolean, ImageFormat)
Exports a single PDF page to an image file on the disk.
Declaration
public bool ExportPage(int pageNumber, string fileName, double scaleSize, bool overrideFileIfAlreadyExist, ImageFormat imageFormat)Parameters
| System.Int32
        pageNumber Number of the page to export. First page has a number 1. A value of 0 means export the current page. | 
| System.String
        fileName Full path to the output image file. | 
| System.Double
        scaleSize Scale factor for the exported image. Value of 1.0 represents the original size. | 
| System.Boolean
        overrideFileIfAlreadyExist When true, overrides the image file if it already exists. | 
| System.Drawing.Imaging.ImageFormat
        imageFormat The image format to use when saving the image. | 
Returns
| System.Boolean Returns true if the export was successful, false if the file already exists and overrideFileIfAlreadyExist is false. | 
ExportPages(Double, Boolean, ImageFormat)
Exports all PDF pages to a collection of Bitmap objects.
Declaration
public IEnumerable<Bitmap> ExportPages(double scaleSize, bool overrideFileIfAlreadyExist, ImageFormat imageFormat)Parameters
| System.Double
        scaleSize Scale factor for the exported images. Value of 1.0 represents the original size. | 
| System.Boolean
        overrideFileIfAlreadyExist When true, overrides existing files if encountered during the operation. | 
| System.Drawing.Imaging.ImageFormat
        imageFormat The image format to use when creating the bitmaps. | 
Returns
| System.Collections.Generic.IEnumerable<System.Drawing.Bitmap> Returns a collection of Bitmap objects, one for each page in the document. These Bitmaps should be disposed manually when no longer needed. | 
ExportPages(String, Double, Boolean, ImageFormat)
Exports all PDF pages to image files on the disk with sequential numbering.
Declaration
public bool ExportPages(string fileName, double scaleSize, bool overrideFileIfAlreadyExist, ImageFormat imageFormat)Parameters
| System.String
        fileName Base name for the output image files. Page numbers will be appended automatically. | 
| System.Double
        scaleSize Scale factor for the exported images. Value of 1.0 represents the original size. | 
| System.Boolean
        overrideFileIfAlreadyExist When true, overrides the image files if they already exist. | 
| System.Drawing.Imaging.ImageFormat
        imageFormat The image format to use when saving the images. | 
Returns
| System.Boolean Returns true if all exports were successful, false if any file already existed and overrideFileIfAlreadyExist is false. | 
GetCurrentBookmark()
Gets the bookmark nearest to the current viewing position in the document.
Declaration
public BookmarkItem GetCurrentBookmark()Returns
| BookmarkItem The BookmarkItem representing the nearest bookmark to the current position. | 
GetDocumentAsStream()
Gets the currently loaded PDF document as a stream.
Declaration
public Stream GetDocumentAsStream()Returns
| System.IO.Stream A stream containing the PDF document data. | 
HideBookmarks()
Hides the PDF document's bookmarks panel in the viewer.
Declaration
public void HideBookmarks()HideSignaturePanel()
Hides the PDF document's signature panel in the viewer.
Declaration
public void HideSignaturePanel()HideThumbnails()
Hide the Pdf document's thumbnails
Declaration
public void HideThumbnails()IsInputKey(Keys)
Determines whether the specified key is a regular input key or a special key that requires preprocessing.
Declaration
protected override bool IsInputKey(Keys keyData)Parameters
| System.Windows.Forms.Keys
        keyData One of the Keys values. | 
Returns
| System.Boolean True if the specified key is a regular input key; otherwise, false. | 
Overrides
LoadDocument(Stream)
Loads a PDF document from a specified stream.
Declaration
public void LoadDocument(Stream stream)Parameters
| System.IO.Stream
        stream The stream of PDF data. | 
LoadDocument(String)
Loads a PDF document from a specified file name.
Declaration
public void LoadDocument(string path)Parameters
| System.String
        path The path of the PDF file. | 
OnCaptureLosing()
Raises the CaptureLosing event. Handles cases when the control loses capture.
Declaration
protected override void OnCaptureLosing()Overrides
OnKeyDown(KeyEventArgs)
Raises the KeyDown event. Handles keyboard input in the PDF viewer.
Declaration
protected override void OnKeyDown(KeyEventArgs e)Parameters
| System.Windows.Forms.KeyEventArgs
        e A KeyEventArgs that contains the event data. | 
Overrides
OnLoad(Size)
Declaration
protected override void OnLoad(Size desiredSize)Parameters
| System.Drawing.Size
        desiredSize 
 | 
Overrides
OnMouseDown(MouseEventArgs)
Raises the MouseDown event. Handles mouse button presses over the PDF viewer.
Declaration
protected override void OnMouseDown(MouseEventArgs e)Parameters
| System.Windows.Forms.MouseEventArgs
        e A MouseEventArgs that contains the event data. | 
Overrides
OnMouseMove(MouseEventArgs)
Raises the MouseMove event. Handles mouse movement over the PDF viewer.
Declaration
protected override void OnMouseMove(MouseEventArgs e)Parameters
| System.Windows.Forms.MouseEventArgs
        e A MouseEventArgs that contains the event data. | 
Overrides
OnMouseUp(MouseEventArgs)
Raises the MouseUp event. Handles mouse button releases over the PDF viewer.
Declaration
protected override void OnMouseUp(MouseEventArgs e)Parameters
| System.Windows.Forms.MouseEventArgs
        e A MouseEventArgs that contains the event data. | 
Overrides
OnMouseWheel(MouseEventArgs)
Declaration
protected override void OnMouseWheel(MouseEventArgs e)Parameters
| System.Windows.Forms.MouseEventArgs
        e 
 | 
Overrides
OnThemeChanged()
PageDown()
Navigates to the next page.
Declaration
public void PageDown()PageUp()
Navigates to the previous page.
Declaration
public void PageUp()Print()
Print(Boolean)
Directly prints the RadPdfViewer to the default printer or shows printer settitngs and then prints the RadPdfViewer.
Declaration
public virtual void Print(bool showPrinterSettings)Parameters
| System.Boolean
        showPrinterSettings Indicates whether printer settings dialog should be shown. | 
Print(Boolean, RadPrintDocument)
Directly prints the RadPdfViewer to the default printer or shows printer settitngs and then prints the RadPdfViewer.
Declaration
public virtual void Print(bool showPrinterSettings, RadPrintDocument document)Parameters
| System.Boolean
        showPrinterSettings Indicates whether printer settings dialog should be shown. | 
| RadPrintDocument
        document As instance of RadPrintDocument used to control the print process. | 
PrintPreview()
Shows a RadPrintPreviewDialog for editing the RadPdfViewer print settings.
Declaration
public virtual void PrintPreview()PrintPreview(RadPrintDocument)
Shows a RadPrintPreviewDialog for editing the RadPdfViewer print settings.
Declaration
public virtual void PrintPreview(RadPrintDocument document)Parameters
| RadPrintDocument
        document As instance of RadPrintDocument used to control the print process. | 
ProcessCmdKey(ref Message, Keys)
Processes a command key. Handles Tab and Shift+Tab for navigating between form fields in the PDF document.
Declaration
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)Parameters
| System.Windows.Forms.Message
        msg A Message, passed by reference, that represents the Win32 message to process. | 
| System.Windows.Forms.Keys
        keyData One of the Keys values that represents the key to process. | 
Returns
| System.Boolean True if the character was processed by the control; otherwise, false. | 
Rotate(RotationAngle)
Rotates all pages in the document to the specified angle.
Declaration
public virtual void Rotate(RotationAngle angle)Parameters
| RotationAngle
        angle The rotation angle to apply to all pages. | 
SaveDocument(Stream)
Saves the currently loaded PDF document to a stream.
Declaration
public bool SaveDocument(Stream outputStream)Parameters
| System.IO.Stream
        outputStream The stream to save the document to. | 
Returns
| System.Boolean True if the save operation was successful; otherwise, false. | 
SaveDocument(String)
Saves the currently loaded PDF document to a file.
Declaration
public bool SaveDocument(string fileName)Parameters
| System.String
        fileName The full path and name of the file to save to. | 
Returns
| System.Boolean True if the save operation was successful; otherwise, false. | 
ScaleControl(SizeF, BoundsSpecified)
Scales the control and its contents according to the specified scaling factor.
Declaration
protected override void ScaleControl(SizeF factor, BoundsSpecified specified)Parameters
| System.Drawing.SizeF
        factor The factor by which to scale the control. | 
| System.Windows.Forms.BoundsSpecified
        specified A bitwise combination of BoundsSpecified values. | 
Overrides
Select(SearchResult)
Creates selection from start position to end position.
Declaration
public void Select(SearchResult result)Parameters
| SearchResult
        result The result from search. | 
ShowBookmarks()
Show the Pdf document's bookmarks
Declaration
public void ShowBookmarks()ShowSignaturePanel()
Shows the PDF document's signature panel, allowing users to view and interact with digital signatures.
Declaration
public void ShowSignaturePanel()ShowThubnails()
Obsolete! Use ShowThumbnails() method instead.
Declaration
[Obsolete("Obsolete! Use ShowThumbnails method instead.")]
public void ShowThubnails()ShowThumbnails()
Show the Pdf document's thumbnails
Declaration
public void ShowThumbnails()SyncCurrentBookmark()
Sync the nearest bookmark from the Pdf document's to the tree
Declaration
public void SyncCurrentBookmark()UnloadDocument()
Unload the current PDF document.
Declaration
public void UnloadDocument()Events
AnnotationClicked
Fires when a link or a bookmark was clicked.
Declaration
public event EventHandler<AnnotationEventArgs> AnnotationClickedEvent Type
| System.EventHandler<AnnotationEventArgs> 
 | 
CaretPositionChanged
Fires when the caret changes its position.
Declaration
public event EventHandler CaretPositionChangedEvent Type
| System.EventHandler 
 | 
CurrentPageChanged
Fires after the current RadFixedPage has been changed.
Declaration
public event CurrentPageChangedEventHandler CurrentPageChangedEvent Type
| CurrentPageChangedEventHandler 
 | 
DataError
Fires when an internal exception in during loading parts of the document occurs. If the event is not handled, a default error message box will be shown, otherwise the message box will not show and handling the error should be done in the event handler.
Declaration
public event PdfExceptionEventHandler DataErrorEvent Type
| PdfExceptionEventHandler 
 | 
DocumentLoaded
Fires when the document has finished loading.
Declaration
public event EventHandler DocumentLoadedEvent Type
| System.EventHandler 
 | 
FitFullPageChanged
Fires when the FitFullPage property has changed.
Declaration
public event EventHandler FitFullPageChangedEvent Type
| System.EventHandler 
 | 
FitToWidthChanged
Fires when the FitToWidth property has changed.
Declaration
public event EventHandler FitToWidthChangedEvent Type
| System.EventHandler 
 | 
HyperlinkClicked
Occurs when the hyperlink is clicked.
Declaration
public event EventHandler<HyperlinkClickedEventArgs> HyperlinkClickedEvent Type
| System.EventHandler<HyperlinkClickedEventArgs> 
 | 
PageElementCreating
Fires when a RadFixedPageElement is being created. Allows for replacing it with custom page element.
Declaration
public event RadFixedPageElementEventHandler PageElementCreatingEvent Type
| RadFixedPageElementEventHandler 
 | 
PageRenderCompleted
Fires when a RadFixedPageElement has been asynchronously rendered.
Declaration
public event EventHandler PageRenderCompletedEvent Type
| System.EventHandler 
 | 
PageRenderStarted
Fires when a RadFixedPageElement is about to be asynchronously rendered.
Declaration
public event EventHandler PageRenderStartedEvent Type
| System.EventHandler 
 | 
PdfSignaturePanelVisibilityChanged
Fires when SignaturePanel hides or shows
Declaration
public event EventHandler PdfSignaturePanelVisibilityChangedEvent Type
| System.EventHandler 
 | 
ScaleFactorChanged
Fires when the ScaleFactor property has changed.
Declaration
public event EventHandler ScaleFactorChangedEvent Type
| System.EventHandler 
 | 
SelectionChanged
Fires when the text selection has changed.
Declaration
public event EventHandler SelectionChangedEvent Type
| System.EventHandler 
 | 
ViewerModeChanged
Fires when the ViewerMode property has changed.
Declaration
public event EventHandler ViewerModeChangedEvent Type
| System.EventHandler 
 | 
Explicit Interface Implementations
IPrintable.BeginPrint(RadPrintDocument, PrintEventArgs)
Declaration
int IPrintable.BeginPrint(RadPrintDocument sender, PrintEventArgs args)Parameters
| RadPrintDocument
        sender 
 | 
| System.Drawing.Printing.PrintEventArgs
        args 
 | 
Returns
| System.Int32 
 | 
Implements
IPrintable.EndPrint(RadPrintDocument, PrintEventArgs)
Declaration
bool IPrintable.EndPrint(RadPrintDocument sender, PrintEventArgs args)Parameters
| RadPrintDocument
        sender 
 | 
| System.Drawing.Printing.PrintEventArgs
        args 
 | 
Returns
| System.Boolean 
 | 
Implements
IPrintable.GetSettingsDialog(RadPrintDocument)
Declaration
Form IPrintable.GetSettingsDialog(RadPrintDocument document)Parameters
| RadPrintDocument
        document 
 | 
Returns
| System.Windows.Forms.Form 
 | 
Implements
IPrintable.PrintPage(Int32, RadPrintDocument, PrintPageEventArgs)
Declaration
bool IPrintable.PrintPage(int pageNumber, RadPrintDocument sender, PrintPageEventArgs args)Parameters
| System.Int32
        pageNumber 
 | 
| RadPrintDocument
        sender 
 | 
| System.Drawing.Printing.PrintPageEventArgs
        args 
 | 
Returns
| System.Boolean 
 |