Class RadPdfViewer
RadPdfViewer is a control that can visualize PDF documents straight in your application. It comes with a predefined UI that is intuitive and provides the means for utilizing the features of the control. Using the UI you can easily zoom in and out, and scroll the document in the viewer. You can also use pan. The control utilizes virtualization in order to guarantee good performance with larger documents.
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, IPrintable
Constructors
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
Fit one full page to control
Declaration
public bool FitFullPage { get; set; }
Property Value
System.Boolean
|
FitToWidth
Fit to window width
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 angle for pages rotation
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)
Declaration
protected override void CreateChildItems(RadElement parent)
Parameters
RadElement
parent
|
Overrides
CreateContainerElement(RadPdfViewerElement)
Declaration
protected virtual RadPdfViewerContainer CreateContainerElement(RadPdfViewerElement ownerElement)
Parameters
RadPdfViewerElement
ownerElement
|
Returns
RadPdfViewerContainer
|
CreateViewerElement()
ExportPage(Int32, Double, Boolean, ImageFormat)
Export a single Pdf Page to a Bitmap
Declaration
public Bitmap ExportPage(int pageNumber, double aspectRatio, bool overrideFileIfAlreadyExist, ImageFormat imageFormat)
Parameters
System.Int32
pageNumber
Number of the page to export. Firts page have a number 1. 0 means export of the current page. |
System.Double
aspectRatio
Scale factor. 1 mean original size. |
System.Boolean
overrideFileIfAlreadyExist
override image file if they exists |
System.Drawing.Imaging.ImageFormat
imageFormat
Specify an image format when saving the image |
Returns
System.Drawing.Bitmap
returns a Bitmap. This bitmap should be disposed manually. |
ExportPage(Int32, String, Double, Boolean, ImageFormat)
Export 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. Firts page have a number 1. 0 means export of the current page. |
System.String
fileName
Output image file |
System.Double
scaleSize
Scale factor. 1 mean original size. |
System.Boolean
overrideFileIfAlreadyExist
override image file if they exists |
System.Drawing.Imaging.ImageFormat
imageFormat
Specify an image format when saving the image |
Returns
System.Boolean
returns False if file already exist and overrideFileIfAlreadyExist is false |
ExportPages(Double, Boolean, ImageFormat)
Export all Pdf Pages to a collection of Bitmaps
Declaration
public IEnumerable<Bitmap> ExportPages(double scaleSize, bool overrideFileIfAlreadyExist, ImageFormat imageFormat)
Parameters
System.Double
scaleSize
Scale factor - 1 mean original size. |
System.Boolean
overrideFileIfAlreadyExist
override image file if they exists |
System.Drawing.Imaging.ImageFormat
imageFormat
Specify an image format when saving the image |
Returns
System.Collections.Generic.IEnumerable<System.Drawing.Bitmap>
returns collection of Bitmaps. These Bitmaps should be disposed manually. |
ExportPages(String, Double, Boolean, ImageFormat)
Export all Pdf Pages to an image files on the disk
Declaration
public bool ExportPages(string fileName, double scaleSize, bool overrideFileIfAlreadyExist, ImageFormat imageFormat)
Parameters
System.String
fileName
Output image file |
System.Double
scaleSize
Scale factor - 1 mean original size. |
System.Boolean
overrideFileIfAlreadyExist
override image file if they exists |
System.Drawing.Imaging.ImageFormat
imageFormat
Specify an image format when saving the image |
Returns
System.Boolean
returns False if file already exist and overrideFileIfAlreadyExist set to False |
GetCurrentBookmark()
Get the nearest bookmark from the Pdf document's
Declaration
public BookmarkItem GetCurrentBookmark()
Returns
BookmarkItem
the bookmark item. |
GetDocumentAsStream()
Gets the PDF document as stream
Declaration
public Stream GetDocumentAsStream()
Returns
System.IO.Stream
|
HideBookmarks()
Hide the Pdf document's Bookmarks
Declaration
public void HideBookmarks()
HideSignaturePanel()
Hide the Pdf document's Signature panel
Declaration
public void HideSignaturePanel()
HideThumbnails()
Hide the Pdf document's thumbnails
Declaration
public void HideThumbnails()
IsInputKey(Keys)
Declaration
protected override bool IsInputKey(Keys keyData)
Parameters
System.Windows.Forms.Keys
keyData
|
Returns
System.Boolean
|
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()
OnKeyDown(KeyEventArgs)
Declaration
protected override void OnKeyDown(KeyEventArgs e)
Parameters
System.Windows.Forms.KeyEventArgs
e
|
Overrides
OnLoad(Size)
Declaration
protected override void OnLoad(Size desiredSize)
Parameters
System.Drawing.Size
desiredSize
|
Overrides
OnMouseDown(MouseEventArgs)
Declaration
protected override void OnMouseDown(MouseEventArgs e)
Parameters
System.Windows.Forms.MouseEventArgs
e
|
Overrides
OnMouseMove(MouseEventArgs)
Declaration
protected override void OnMouseMove(MouseEventArgs e)
Parameters
System.Windows.Forms.MouseEventArgs
e
|
Overrides
OnMouseUp(MouseEventArgs)
Declaration
protected override void OnMouseUp(MouseEventArgs e)
Parameters
System.Windows.Forms.MouseEventArgs
e
|
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)
Declaration
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
Parameters
System.Windows.Forms.Message
msg
|
System.Windows.Forms.Keys
keyData
|
Returns
System.Boolean
|
Rotate(RotationAngle)
Rotates pages with Ratation Angle
Declaration
public virtual void Rotate(RotationAngle angle)
Parameters
RotationAngle
angle
|
SaveDocument(Stream)
Declaration
public bool SaveDocument(Stream outputStream)
Parameters
System.IO.Stream
outputStream
|
Returns
System.Boolean
|
SaveDocument(String)
Save the PDF document to file
Declaration
public bool SaveDocument(string fileName)
Parameters
System.String
fileName
|
Returns
System.Boolean
|
ScaleControl(SizeF, BoundsSpecified)
Declaration
protected override void ScaleControl(SizeF factor, BoundsSpecified specified)
Parameters
System.Drawing.SizeF
factor
|
System.Windows.Forms.BoundsSpecified
specified
|
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()
Show the Pdf document's Signature panel
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> AnnotationClicked
Event Type
System.EventHandler<AnnotationEventArgs>
|
CaretPositionChanged
Fires when the caret changes its position.
Declaration
public event EventHandler CaretPositionChanged
Event Type
System.EventHandler
|
CurrentPageChanged
Fires after the current RadFixedPage has been changed.
Declaration
public event CurrentPageChangedEventHandler CurrentPageChanged
Event 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 DataError
Event Type
PdfExceptionEventHandler
|
DocumentLoaded
Fires when the document has finished loading.
Declaration
public event EventHandler DocumentLoaded
Event Type
System.EventHandler
|
FitFullPageChanged
Fires when the FitFullPage property has changed.
Declaration
public event EventHandler FitFullPageChanged
Event Type
System.EventHandler
|
FitToWidthChanged
Fires when the FitToWidth property has changed.
Declaration
public event EventHandler FitToWidthChanged
Event Type
System.EventHandler
|
HyperlinkClicked
Occurs when the hyperlink is clicked.
Declaration
public event EventHandler<HyperlinkClickedEventArgs> HyperlinkClicked
Event Type
System.EventHandler<HyperlinkClickedEventArgs>
|
PageElementCreating
Fires when a RadFixedPageElement is being created. Allows for replacing it with custom page element.
Declaration
public event RadFixedPageElementEventHandler PageElementCreating
Event Type
RadFixedPageElementEventHandler
|
PageRenderCompleted
Fires when a RadFixedPageElement has been asynchronously rendered.
Declaration
public event EventHandler PageRenderCompleted
Event Type
System.EventHandler
|
PageRenderStarted
Fires when a RadFixedPageElement is about to be asynchronously rendered.
Declaration
public event EventHandler PageRenderStarted
Event Type
System.EventHandler
|
PdfSignaturePanelVisibilityChanged
Fires when SignaturePanel hides or shows
Declaration
public event EventHandler PdfSignaturePanelVisibilityChanged
Event Type
System.EventHandler
|
ScaleFactorChanged
Fires when the ScaleFactor property has changed.
Declaration
public event EventHandler ScaleFactorChanged
Event Type
System.EventHandler
|
SelectionChanged
Fires when the text selection has changed.
Declaration
public event EventHandler SelectionChanged
Event Type
System.EventHandler
|
ViewerModeChanged
Fires when the ViewerMode property has changed.
Declaration
public event EventHandler ViewerModeChanged
Event 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
|