Class RadPdfViewerElement
Represents the main element of the RadPdfViewer control.
Inheritance
Inherited Members
Namespace: Telerik.WinControls.UI
Assembly: Telerik.WinControls.PdfViewer.dll
Syntax
public class RadPdfViewerElement : VirtualizedScrollPanel<RadFixedPage, RadFixedPageElement>, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IComponent, IDisposable, IBindableComponent, ISupportDrag, ISupportDrop, IShortcutProvider, IStylableElement, IStylableNode, IPrimitiveElement, IShapedElement, IFillElement, IBorderElement, IBoxStyle, IBoxElement, IDrawFillElement, IImageElement, ITextPrimitive, ITextProvider, IFixedDocumentPresenter, IPrintable
Constructors
RadPdfViewerElement()
Initializes a new instance of the RadPdfViewerElement class. Sets up initial component configurations, input handlers, and UI elements.
Declaration
public RadPdfViewerElement()
Properties
AllowSignatureDialog
Gets or sets whether the signature verification dialog should be displayed when encountering digital signatures. When disabled, signature verification information will not be shown to the user.
Declaration
public bool AllowSignatureDialog { get; set; }
Property Value
System.Boolean
|
AllowSignSignatureDialog
Gets or sets whether the dialog for adding new digital signatures should be displayed. When disabled, users will not be able to sign documents through the standard dialog.
Declaration
public bool AllowSignSignatureDialog { get; set; }
Property Value
System.Boolean
|
Annotations
Declaration
public Dictionary<RadFixedPage, RadElement> Annotations { get; set; }
Property Value
System.Collections.Generic.Dictionary<RadFixedPage, RadElement>
|
AnnotationsColor
Gets or sets the background color of the annotations when they are pressed or highlighted. This color is used to visually indicate interactive annotation elements in the document.
Declaration
public Color AnnotationsColor { get; set; }
Property Value
System.Drawing.Color
|
AsyncRender
Gets or sets whether pages are rendered asynchronously. When enabled, pages are rendered on background threads to prevent UI freezing during complex page rendering.
Declaration
public bool AsyncRender { get; set; }
Property Value
System.Boolean
True if asynchronous rendering is enabled; otherwise, false. |
CacheCapacity
Gets or sets the maximum number of pages that can be cached in memory. Higher values increase memory usage but improve performance when navigating between pages.
Declaration
public int CacheCapacity { get; set; }
Property Value
System.Int32
The maximum number of pages that can be stored in the cache. |
CachePaint
Gets or sets whether page caching is enabled for painting operations. When enabled, rendered pages are stored in memory to improve performance during scrolling and navigation.
Declaration
public bool CachePaint { get; set; }
Property Value
System.Boolean
True if page caching is enabled; otherwise, false. |
CanScrollHorizontally
Gets whether horizontal scrolling is possible in the current state. Returns true if the document width exceeds the visible width of the control.
Declaration
public bool CanScrollHorizontally { get; }
Property Value
System.Boolean
True if horizontal scrolling is possible; otherwise, false. |
Implements
CanScrollVertically
Gets whether vertical scrolling is possible in the current state. Returns true if the document height exceeds the visible height of the control and discrete mode is not active.
Declaration
public bool CanScrollVertically { get; }
Property Value
System.Boolean
True if vertical scrolling is possible; otherwise, false. |
Implements
ContextMenu
Gets or sets the context menu that appears when right-clicking within the PDF viewer. By default, this is an instance of PdfViewerContextMenu with standard PDF viewing options.
Declaration
public RadContextMenu ContextMenu { get; set; }
Property Value
RadContextMenu
|
CurrentPage
Gets the currently visible page in the viewer. Triggers the CurrentPageChanged event when the visible page changes.
Declaration
public RadFixedPage CurrentPage { get; }
Property Value
RadFixedPage
The current RadFixedPage being displayed, or null if no page is visible. |
Implements
Document
Gets or sets the currently loaded PDF document. Setting this property automatically unloads any previous document and loads the new one.
Declaration
public RadFixedDocument Document { get; set; }
Property Value
RadFixedDocument
|
Implements
EditingFields
FitFullPage
Gets or sets whether the document should be scaled to fit the entire page within the viewer. When enabled, the viewer will show complete pages and use discrete scrolling between pages.
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. When enabled, the document will be automatically resized horizontally to fill the available width.
Declaration
public bool FitToWidth { get; set; }
Property Value
System.Boolean
|
HorizontalScrollState
Gets or sets the display state of the horizontal scrollbar. Controls whether the horizontal scrollbar is always visible, hidden, or only appears when needed.
Declaration
public ScrollState HorizontalScrollState { get; set; }
Property Value
ScrollState
|
ImportSettings
Gets or sets the settings used when importing PDF documents. Controls aspects like reading mode, password handling, and stream management.
Declaration
public PdfImportSettings ImportSettings { get; set; }
Property Value
PdfImportSettings
The current import settings, creating default settings if none have been set. |
Mode
Gets or sets the current viewer mode that determines how mouse input is interpreted. Supported modes include Pan (for navigation), TextSelection (for selecting text), and None.
Declaration
public FixedDocumentViewerMode Mode { get; set; }
Property Value
FixedDocumentViewerMode
The current FixedDocumentViewerMode value. |
Implements
MouseController
Gets the MouseHandlersController which manages all mouse input handling for the PDF viewer. Controls behaviors like text selection, panning, and annotation interaction.
Declaration
public MouseHandlersController MouseController { get; }
Property Value
MouseHandlersController
|
MouseHandlersController
Gets the MouseHandlersController which handles and manages all mouse input for the PDF viewer. The controller processes mouse events and delegates them to appropriate handlers based on the current viewer mode.
Declaration
public MouseHandlersController MouseHandlersController { get; }
Property Value
MouseHandlersController
The MouseHandlersController instance that manages mouse interactions. |
Implements
PdfNavigationBehavior
PrintOrientation
Gets or sets the page orientation used when printing the document. Can be set to Portrait, Landscape, or Auto (determines orientation based on page content).
Declaration
public PrintOrientation PrintOrientation { get; set; }
Property Value
PrintOrientation
|
PrintScalePageToPaperSize
Gets or sets whether pages are scaled during printing to fit the paper size without preserving aspect ratio. When enabled, pages will be stretched or compressed to fill the entire printable area.
Declaration
public bool PrintScalePageToPaperSize { get; set; }
Property Value
System.Boolean
|
ReadingMode
Gets or sets whether the entire document is loaded immediately or pages are loaded as they're needed. This affects memory usage and initial loading performance of large documents.
Declaration
public ReadingMode ReadingMode { get; set; }
Property Value
ReadingMode
|
RotateAngle
Gets or sets the rotation angle for all pages in the document. Changes to this property will cause the document pages to be redrawn with the new orientation.
Declaration
public RotationAngle RotateAngle { get; set; }
Property Value
RotationAngle
The current rotation angle applied to the document. |
ScaleFactor
Gets or sets the zoom factor by which the document is scaled. Values range from 0.01 (1%) to 62.0 (6200%), with 1.0 representing the original document size.
Declaration
public float ScaleFactor { get; set; }
Property Value
System.Single
|
SelectionColor
Gets or sets the color used to highlight text selections within the PDF document. This color is applied as a semi-transparent overlay on selected text content.
Declaration
public Color SelectionColor { get; set; }
Property Value
System.Drawing.Color
|
SignatureValidationProperties
Gets or sets the properties used for validating digital signatures in the PDF document. Controls how signature validation is performed and displayed.
Declaration
public SignatureValidationProperties SignatureValidationProperties { get; set; }
Property Value
SignatureValidationProperties
The current signature validation properties. |
UseBufferedPrinting
Gets or sets whether buffered printing is used. When true, the page is rendered to an image before being sent to the printer, which may result in quality loss but can improve compatibility.
Declaration
public bool UseBufferedPrinting { get; set; }
Property Value
System.Boolean
True if buffered printing is enabled; otherwise, false. |
UsePdfProcessingModel
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
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. Controls whether the vertical scrollbar is always visible, hidden, or only appears when needed.
Declaration
public ScrollState VerticalScrollState { get; set; }
Property Value
ScrollState
|
Methods
ArrangeOverride(SizeF)
Overrides the default arrangement behavior to position the waiting bar within the element.
Declaration
protected override SizeF ArrangeOverride(SizeF finalSize)
Parameters
System.Drawing.SizeF
finalSize
The final size allocated for the element. |
Returns
System.Drawing.SizeF
The actual size used by the element. |
Overrides
BringIntoView(TextPosition)
Scrolls the viewer horizontally and vertically to ensure that the specified text position is visible. This is useful when programmatically navigating to specific text content within the document.
Declaration
public void BringIntoView(TextPosition textPosition)
Parameters
TextPosition
textPosition
The text position that should be made visible in the viewport. |
Copy()
Copies the currently selected text in the document to the system clipboard. If no text is selected or no document is loaded, this operation does nothing.
Declaration
public void Copy()
CreateChildElements()
Creates and initializes all child elements of the PDF viewer including the waiting bar, and sets up default visual appearance.
Declaration
protected override void CreateChildElements()
Overrides
CreateElementProvider()
Creates the element provider responsible for virtualizing PDF page elements.
Declaration
protected override IVirtualizedElementProvider<RadFixedPage> CreateElementProvider()
Returns
IVirtualizedElementProvider<RadFixedPage>
A FixedPageElementProvider that manages the creation and recycling of page elements. |
Overrides
CreateItemScroller()
Creates and initializes the item scroller used to scroll through PDF pages.
Declaration
protected override ItemScroller<RadFixedPage> CreateItemScroller()
Returns
ItemScroller<RadFixedPage>
A specialized PdfItemScroller instance to handle PDF page scrolling. |
Overrides
CreatePageElement(RadFixedPage, Object)
Creates a RadFixedPageElement for displaying a RadFixedPage in the viewer. Fires the PageElementCreating event to allow customization of the created element.
Declaration
public virtual IVirtualizedElement<RadFixedPage> CreatePageElement(RadFixedPage data, object context)
Parameters
RadFixedPage
data
The RadFixedPage to create an element for. |
System.Object
context
Additional context information for element creation. |
Returns
IVirtualizedElement<RadFixedPage>
A new IVirtualizedElement instance representing the page. |
CreateViewElement()
Creates the main view element container used to display PDF pages.
Declaration
protected override VirtualizedStackContainer<RadFixedPage> CreateViewElement()
Returns
VirtualizedStackContainer<RadFixedPage>
A specialized PdfViewerStackContainer to manage PDF page layout. |
Overrides
DeselectAll()
Clears the current selection.
Declaration
public void DeselectAll()
DisposeManagedResources()
Releases all managed resources used by the element. Unloads the document and disposes of the page renderer and mouse controller.
Declaration
protected override void DisposeManagedResources()
Overrides
ExportPage(Int32, Double, Boolean, ImageFormat)
Exports a single PDF page as a Bitmap image in memory.
Declaration
public Bitmap ExportPage(int pageNumber, double aspectRatio, bool overrideFileIfAlreadyExist, ImageFormat imageFormat)
Parameters
System.Int32
pageNumber
Number of the page to export (1-based index, first page is 1). A value of 0 exports the current visible page. |
System.Double
aspectRatio
Scale factor for the export. Value of 1.0 represents original size. |
System.Boolean
overrideFileIfAlreadyExist
Unused parameter in this overload. |
System.Drawing.Imaging.ImageFormat
imageFormat
Unused parameter in this overload. |
Returns
System.Drawing.Bitmap
A Bitmap containing the rendered PDF page. This bitmap must be manually disposed by the caller. |
ExportPage(Int32, String, Double, Boolean, ImageFormat)
Exports a single PDF page as an image file on disk.
Declaration
public bool ExportPage(int pageNumber, string fileName, double aspectRatio, bool overrideFileIfAlreadyExist, ImageFormat imageFormat)
Parameters
System.Int32
pageNumber
Number of the page to export (1-based index, first page is 1). A value of 0 exports the current visible page. |
System.String
fileName
Full path where the output image file should be saved. |
System.Double
aspectRatio
Scale factor for the export. Value of 1.0 represents original size. |
System.Boolean
overrideFileIfAlreadyExist
When true, overwrites any existing file with the same name. |
System.Drawing.Imaging.ImageFormat
imageFormat
The image format to use when saving the file (PNG, JPEG, BMP, etc). |
Returns
System.Boolean
True if the page was successfully exported; false if the file exists and overrideFileIfAlreadyExist is false. |
ExportPages(Double, Boolean, ImageFormat)
Exports all PDF pages as a collection of Bitmap images in memory.
Declaration
public IEnumerable<Bitmap> ExportPages(double aspectRatio, bool overrideFileIfAlreadyExist, ImageFormat imageFormat)
Parameters
System.Double
aspectRatio
Scale factor for the export. Value of 1.0 represents original size. |
System.Boolean
overrideFileIfAlreadyExist
Unused parameter in this overload. |
System.Drawing.Imaging.ImageFormat
imageFormat
Unused parameter in this overload. |
Returns
System.Collections.Generic.IEnumerable<System.Drawing.Bitmap>
A collection of Bitmap objects, one for each page in the document. These Bitmaps must be manually disposed by the caller. |
ExportPages(String, Double, Boolean, ImageFormat)
Exports all PDF pages as separate image files on disk. Page numbers will be appended to the filename (e.g., file-1.png, file-2.png).
Declaration
public bool ExportPages(string fileName, double aspectRatio, bool overrideFileIfAlreadyExist, ImageFormat imageFormat)
Parameters
System.String
fileName
Base path and filename pattern for the output image files. |
System.Double
aspectRatio
Scale factor for the export. Value of 1.0 represents original size. |
System.Boolean
overrideFileIfAlreadyExist
When true, overwrites any existing files with the same names. |
System.Drawing.Imaging.ImageFormat
imageFormat
The image format to use when saving the files (PNG, JPEG, BMP, etc). |
Returns
System.Boolean
True if all pages were successfully exported; false if any file exists and overrideFileIfAlreadyExist is false. |
Find(String)
Finds the specified text in the current document using default search options.
Declaration
public SearchResult Find(string text)
Parameters
System.String
text
The text to search for in the document. |
Returns
SearchResult
A SearchResult object containing information about the found text position or SearchResult.NotFound if the text was not found. |
Find(String, Int32)
Finds the specified text in a specific page of the current document. This search is limited to the specified page only and will not search across multiple pages.
Declaration
public SearchResult Find(string text, int pageNumber)
Parameters
System.String
text
The text to search for in the document. |
System.Int32
pageNumber
The page number (1-based) to search within. |
Returns
SearchResult
A SearchResult object containing information about the found text position or SearchResult.NotFound if the text was not found on the specified page. |
Find(String, TextSearchOptions)
Finds the specified text in the current document using specified search options.
Declaration
public SearchResult Find(string text, TextSearchOptions options)
Parameters
System.String
text
The text to search for in the document. |
TextSearchOptions
options
The search options that control case sensitivity, whole word matching, and other search parameters. |
Returns
SearchResult
A SearchResult object containing information about the found text position or SearchResult.NotFound if the text was not found. |
FindPrevious(String)
Finds the previous occurrence of the specified text in the current document using default search options. The search begins from the current selection or position and moves backward through the document.
Declaration
public SearchResult FindPrevious(string text)
Parameters
System.String
text
The text to search for in the document. |
Returns
SearchResult
A SearchResult object containing information about the found text position or SearchResult.NotFound if the text was not found. |
FindPrevious(String, TextSearchOptions)
Finds the previous occurrence of the specified text in the current document using specified search options. The search begins from the current selection or position and moves backward through the document.
Declaration
public SearchResult FindPrevious(string text, TextSearchOptions options)
Parameters
System.String
text
The text to search for in the document. |
TextSearchOptions
options
The search options that control case sensitivity, whole word matching, and other search parameters. |
Returns
SearchResult
A SearchResult object containing information about the found text position or SearchResult.NotFound if the text was not found. |
FitFullPageCore()
Adjusts the scale factor to fit the entire current page in the viewer. Calculates the optimal scale that allows the page to be fully visible within the available space.
Declaration
public void FitFullPageCore()
FitPageToWidthCore()
Adjusts the scale factor to fit the current page width to the viewer width. Takes into account the orientation of the page and available space in the control.
Declaration
public void FitPageToWidthCore()
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, or null if no document is loaded. |
GetFocusedPage()
Gets the page element which contains the text caret when text selection is active.
Declaration
public RadFixedPageElement GetFocusedPage()
Returns
RadFixedPageElement
The RadFixedPageElement containing the caret, or null if text operations are not supported or no caret exists. |
GetLocationFromViewPoint(Point, out RadFixedPage, out Point)
Converts a point in view coordinates to a location on a PDF page. Takes into account scrolling position and rotation angle of the document.
Declaration
public bool GetLocationFromViewPoint(Point viewPoint, out RadFixedPage page, out Point location)
Parameters
System.Drawing.Point
viewPoint
The point in viewer coordinates. |
RadFixedPage
page
When this method returns, contains the page that the point is on, or null if the point is not on any page. |
System.Drawing.Point
location
When this method returns, contains the point in page coordinates, or Point.Empty if the point is not on any page. |
Returns
System.Boolean
True if the point is on a page; otherwise, false. |
Implements
GetPageElement(RadFixedPage)
Gets the visual page element which corresponds to a specific logical page from the document.
Declaration
public RadFixedPageElement GetPageElement(RadFixedPage page)
Parameters
RadFixedPage
page
The logical page from the document model. |
Returns
RadFixedPageElement
The visual RadFixedPageElement corresponding to the given logical page, or null if the page isn't currently visible. |
GetPageVerticalOffset(RadFixedPage)
Gets the vertical offset in pixels of a specific page from the top edge of the first page in the document. This value is useful for programmatically scrolling to specific pages.
Declaration
public int GetPageVerticalOffset(RadFixedPage page)
Parameters
RadFixedPage
page
The page whose offset should be calculated. |
Returns
System.Int32
The vertical offset in pixels from the top of the document to the specified page. |
GetScrollOffset()
Gets the current scroll offset.
Declaration
public Point GetScrollOffset()
Returns
System.Drawing.Point
The offset |
Implements
GetSelectedText()
Gets the currently selected text content from the document. Returns an empty string if no document is loaded or if no text is selected.
Declaration
public string GetSelectedText()
Returns
System.String
A string containing the selected text, or an empty string if no selection exists. |
GetSelectedTextAsync()
Gets the currently selected text content from the document asynchronously. This is useful for large selections where retrieving the text may be time-consuming.
Declaration
public Task<string> GetSelectedTextAsync()
Returns
System.Threading.Tasks.Task<System.String>
A Task that resolves to a string containing the selected text, or an empty string if no document is loaded or no selection exists. |
GetViewPointFromTextPosition(TextPosition)
Gets the screen coordinates in the viewer corresponding to a specific text position in the document. Useful for positioning UI elements like tooltips or annotations at specific text locations.
Declaration
public Point GetViewPointFromTextPosition(TextPosition position)
Parameters
TextPosition
position
The text position in the document model. |
Returns
System.Drawing.Point
A Point representing the screen coordinates in the viewer, or Point.Empty if the position is invalid. |
GoToDestination(Destination)
GoToPage(Int32)
Navigates to the page with the specified number.
Declaration
public void GoToPage(int pageNo)
Parameters
System.Int32
pageNo
The page number. |
Implements
HideCaret()
Hides the text caret indicator on the current page. Has no effect if there is no focused page or if the caret is already hidden.
Declaration
public void HideCaret()
Implements
HideSignaturePanel()
Hides the signature panel if it's currently visible.
Declaration
public void HideSignaturePanel()
InvalidatePage(RadFixedPage)
Forces a specific page to be redrawn in the viewer. Use this when the page content has changed and needs to be visually updated.
Declaration
public void InvalidatePage(RadFixedPage page)
Parameters
RadFixedPage
page
The page that needs to be redrawn. |
InvalidatePages()
Forces all pages in the document to be redrawn in the viewer. Use this when multiple pages have changed or when global document settings have been modified.
Declaration
public void InvalidatePages()
IsWaiting()
Checks if the loading indicator is currently visible, indicating an operation is in progress.
Declaration
public bool IsWaiting()
Returns
System.Boolean
True if the loading indicator is displayed and waiting; false otherwise. |
LoadDocument(Stream)
Loads a PDF document from a provided stream containing PDF data. Unloads any currently loaded document and displays a waiting indicator while loading.
Declaration
public void LoadDocument(Stream stream)
Parameters
System.IO.Stream
stream
The stream containing the PDF document data to load. |
LoadDocument(String)
Loads a PDF document from a specified file path. Unloads any currently loaded document and displays a waiting indicator while loading.
Declaration
public void LoadDocument(string path)
Parameters
System.String
path
The full path to the PDF file to load. |
LoadDocument(RadFixedDocument)
Loads an already created RadFixedDocument into the PDF viewer. Updates the view and initializes all necessary handlers for the document.
Declaration
public void LoadDocument(RadFixedDocument document)
Parameters
RadFixedDocument
document
The RadFixedDocument to display in the viewer. |
MeasureOverride(SizeF)
Overrides the default measuring behavior to include the waiting bar in measurement calculations.
Declaration
protected override SizeF MeasureOverride(SizeF availableSize)
Parameters
System.Drawing.SizeF
availableSize
The available size for the element. |
Returns
System.Drawing.SizeF
The desired size of the element. |
Overrides
MoveToNextEditor()
Moves focus to the next interactive element (such as form field) in the document.
Declaration
public virtual void MoveToNextEditor()
MoveToPreviousEditor()
Moves focus to the previous interactive element (such as form field) in the document.
Declaration
public virtual void MoveToPreviousEditor()
OnAnnotationClicked(AnnotationEventArgs)
Fires the AnnotationClicked event.
Declaration
protected virtual void OnAnnotationClicked(AnnotationEventArgs e)
Parameters
AnnotationEventArgs
e
|
OnBoundsChanged(RadPropertyChangedEventArgs)
Responds to changes in the element's bounds by adjusting the document view. Updates the page fitting when the control is resized to maintain proper page display.
Declaration
protected override void OnBoundsChanged(RadPropertyChangedEventArgs e)
Parameters
RadPropertyChangedEventArgs
e
The event arguments containing the old and new property values. |
Overrides
OnCaretPositionChanged()
Fires the CaretPositionChanged event.
Declaration
protected virtual void OnCaretPositionChanged()
OnCurrenPageChanged(CurrentPageChangedEventArgs)
Declaration
protected virtual void OnCurrenPageChanged(CurrentPageChangedEventArgs args)
Parameters
CurrentPageChangedEventArgs
args
|
OnDataError(Object, PdfExceptionEventArgs)
Declaration
protected virtual bool OnDataError(object sender, PdfExceptionEventArgs e)
Parameters
System.Object
sender
|
PdfExceptionEventArgs
e
|
Returns
System.Boolean
|
OnDocumentLoaded()
Fires the DocumentLoaded event.
Declaration
protected virtual void OnDocumentLoaded()
OnDocumentUnloaded()
Fires the DocumentLoaded event.
Declaration
protected virtual void OnDocumentUnloaded()
OnFitFullPageChanged(EventArgs)
Fires the FitFullPageChanged event.
Declaration
protected virtual void OnFitFullPageChanged(EventArgs e)
Parameters
System.EventArgs
e
|
OnFitToWidthChanged(EventArgs)
Fires the FitToWidthChanged event.
Declaration
protected virtual void OnFitToWidthChanged(EventArgs e)
Parameters
System.EventArgs
e
|
OnPageElementCreating(RadFixedPageElementEventArgs)
Fires the PageElementCreating event.
Declaration
protected virtual void OnPageElementCreating(RadFixedPageElementEventArgs args)
Parameters
RadFixedPageElementEventArgs
args
|
OnPanGesture(PanGestureEventArgs)
Handles pan gesture events for navigation within the PDF document. Processes touch-based panning gestures to allow scrolling through the document.
Declaration
protected override void OnPanGesture(PanGestureEventArgs args)
Parameters
PanGestureEventArgs
args
The event arguments containing information about the pan gesture. |
Overrides
OnScaleFactorChanged()
Fires the ScaleFactorChanged event.
Declaration
protected virtual void OnScaleFactorChanged()
OnSelectionChanged()
Fires the SelectionChanged event.
Declaration
protected virtual void OnSelectionChanged()
OnViewerModeChanged()
Fires the ViewerModeChanged event.
Declaration
protected virtual void OnViewerModeChanged()
OnZoomGesture(ZoomGestureEventArgs)
Handles zoom gesture events for adjusting the document scale. Processes touch-based pinch and stretch gestures to zoom in and out of the document.
Declaration
protected override void OnZoomGesture(ZoomGestureEventArgs args)
Parameters
ZoomGestureEventArgs
args
The event arguments containing information about the zoom gesture. |
Overrides
PageDown()
Navigates to the next page.
Declaration
public void PageDown()
Implements
PageUp()
Navigates to the previous page.
Declaration
public void PageUp()
Implements
PaintChildren(IGraphics, Rectangle, Single, SizeF, Boolean)
Overrides the default painting behavior to handle page rendering and pre-rendering. Stops pre-rendering during painting and restarts it afterward for multi-page documents.
Declaration
protected override void PaintChildren(IGraphics graphics, Rectangle clipRectange, float angle, SizeF scale, bool useRelativeTransformation)
Parameters
IGraphics
graphics
The graphics context to paint on. |
System.Drawing.Rectangle
clipRectange
The clipping rectangle defining the area to paint. |
System.Single
angle
The rotation angle to apply. |
System.Drawing.SizeF
scale
The scaling factor to apply. |
System.Boolean
useRelativeTransformation
Whether to use relative transformations. |
Overrides
Print()
Directly prints the RadPdfViewer content to the default printer without showing settings dialog. This is a convenience method that calls Print(false).
Declaration
public virtual void Print()
Print(Boolean)
Prints the RadPdfViewer content to the default printer, optionally showing the printer settings dialog.
Declaration
public virtual void Print(bool showPrinterSettings)
Parameters
System.Boolean
showPrinterSettings
True to display the printer settings dialog before printing; false to print directly with default settings. |
Print(Boolean, RadPrintDocument)
Prints the RadPdfViewer content using a specified print document, optionally showing the printer settings dialog.
Declaration
public virtual void Print(bool showPrinterSettings, RadPrintDocument document)
Parameters
System.Boolean
showPrinterSettings
True to display the printer settings dialog before printing; false to print directly with current settings. |
RadPrintDocument
document
The RadPrintDocument instance used to control the print process and settings. |
PrintPreview()
Shows a print preview dialog for the RadPdfViewer content with default margins set to zero. Creates a new RadPrintDocument with appropriate orientation settings.
Declaration
public virtual void PrintPreview()
PrintPreview(RadPrintDocument)
Shows a print preview dialog for the RadPdfViewer content using a specified print document.
Declaration
public virtual void PrintPreview(RadPrintDocument document)
Parameters
RadPrintDocument
document
The RadPrintDocument instance used to control the print process and settings. |
ProcessCaptureLost()
Processes the CaptureLost event that occurs when the element loses mouse capture. This ensures that any ongoing mouse operations are properly terminated.
Declaration
public virtual bool ProcessCaptureLost()
Returns
System.Boolean
True if the event should not be processed further; false to allow normal event propagation. |
ProcessKeyDown(KeyEventArgs)
Processes key down events to handle keyboard navigation and interaction with the PDF document. Handles arrow keys for navigation, Home/End for document positioning, and Page Up/Down for page navigation.
Declaration
public virtual bool ProcessKeyDown(KeyEventArgs e)
Parameters
System.Windows.Forms.KeyEventArgs
e
The key event arguments containing the pressed key information. |
Returns
System.Boolean
True if the event should not be processed further; false to allow normal event propagation. |
ProcessMouseDown(MouseEventArgs, Boolean, Boolean)
Processes mouse down events to handle interactions with the PDF document. Handles right-clicks for context menu, middle-clicks for panning, and left-clicks for selection and navigation.
Declaration
public virtual bool ProcessMouseDown(MouseEventArgs e, bool shift, bool control)
Parameters
System.Windows.Forms.MouseEventArgs
e
The mouse event arguments containing position and button information. |
System.Boolean
shift
True if the Shift key was pressed during the mouse event; otherwise, false. |
System.Boolean
control
True if the Control key was pressed during the mouse event; otherwise, false. |
Returns
System.Boolean
True if the event should not be processed further; false to allow normal event propagation. |
ProcessMouseMove(MouseEventArgs, Boolean, Boolean)
Processes mouse move events to handle interactions with the PDF document. Updates the cursor appearance and tracks mouse movements for selection and other operations.
Declaration
public virtual bool ProcessMouseMove(MouseEventArgs e, bool shift, bool control)
Parameters
System.Windows.Forms.MouseEventArgs
e
The mouse event arguments containing position and button information. |
System.Boolean
shift
True if the Shift key was pressed during the mouse event; otherwise, false. |
System.Boolean
control
True if the Control key was pressed during the mouse event; otherwise, false. |
Returns
System.Boolean
True if the event should not be processed further; false to allow normal event propagation. |
ProcessMouseUp(MouseEventArgs, Boolean, Boolean)
Processes mouse up events to complete interactions with the PDF document. Handles the completion of middle-button panning and left-button selections or clicks.
Declaration
public virtual bool ProcessMouseUp(MouseEventArgs e, bool shift, bool control)
Parameters
System.Windows.Forms.MouseEventArgs
e
The mouse event arguments containing position and button information. |
System.Boolean
shift
True if the Shift key was pressed during the mouse event; otherwise, false. |
System.Boolean
control
True if the Control key was pressed during the mouse event; otherwise, false. |
Returns
System.Boolean
True if the event should not be processed further; false to allow normal event propagation. |
ProcessMouseWheel(MouseEventArgs, Boolean, Boolean)
Processes mouse wheel events to handle zooming and scrolling in the PDF document. When Control key is pressed, zooms in or out; otherwise, scrolls the document vertically.
Declaration
public virtual bool ProcessMouseWheel(MouseEventArgs e, bool shift, bool control)
Parameters
System.Windows.Forms.MouseEventArgs
e
The mouse event arguments containing the wheel delta information. |
System.Boolean
shift
True if the Shift key was pressed during the mouse event; otherwise, false. |
System.Boolean
control
True if the Control key was pressed during the mouse event; otherwise, false. |
Returns
System.Boolean
True if the event should not be processed further; false to allow normal event propagation. |
Rotate(RotationAngle)
Rotates all pages in the document to the specified angle. Clears the page cache and rebuilds the view to reflect the new rotation.
Declaration
public void Rotate(RotationAngle angle)
Parameters
RotationAngle
angle
The angle to rotate the pages to. |
SaveDocument(Stream)
Saves the current PDF document to a stream, including any changes made through form field editing or annotations.
Declaration
public bool SaveDocument(Stream outputStream)
Parameters
System.IO.Stream
outputStream
The stream where the PDF data should be written. |
Returns
System.Boolean
True if the document was successfully saved; otherwise, false. |
SaveDocument(String)
Saves the current PDF document to a file, including any changes made through form field editing or annotations.
Declaration
public bool SaveDocument(string fileName)
Parameters
System.String
fileName
The full path where the PDF file should be saved. |
Returns
System.Boolean
True if the document was successfully saved; otherwise, false. |
Scroll(Nullable<Double>, Nullable<Double>)
Scrolls the view with a specified offset.
Declaration
public void Scroll(double? offsetX, double? offsetY)
Parameters
System.Nullable<System.Double>
offsetX
The offset by X. |
System.Nullable<System.Double>
offsetY
The offset by Y. |
Implements
ScrollTo(Nullable<Double>, Nullable<Double>)
Scrolls to a specified position.
Declaration
public void ScrollTo(double? x, double? y)
Parameters
System.Nullable<System.Double>
x
The x coordinate of the position. |
System.Nullable<System.Double>
y
The y coordinate of the position. |
Implements
Select(SearchResult)
Creates a text selection in the document based on a search result. Also scrolls the view to ensure the start position of the search result is visible.
Declaration
public void Select(SearchResult result)
Parameters
SearchResult
result
The search result containing the text range to select. |
Select(TextPosition, TextPosition)
Creates a text selection in the document from the specified start position to end position. Also scrolls the view to ensure the start position is visible.
Declaration
public void Select(TextPosition startPosition, TextPosition endPosition)
Parameters
TextPosition
startPosition
The starting text position of the selection. |
TextPosition
endPosition
The ending text position of the selection. |
SelectAll()
Selects all text content in the document. This will select all readable text across all pages in the document.
Declaration
public void SelectAll()
ShowCaret()
Shows the text caret indicator on the current page. Only works when text operations are supported in the current document.
Declaration
public void ShowCaret()
Implements
ShowMenu(Point)
Shows the currently assigned context menu at the specified position within the viewer.
Declaration
public void ShowMenu(Point location)
Parameters
System.Drawing.Point
location
The point coordinates where the context menu should be displayed. |
ShowPasswordRequireDialog()
Shows a dialog prompting the user for a password when opening a password-protected PDF. Can be canceled through the PasswordRequireDialogShowing event.
Declaration
protected virtual string ShowPasswordRequireDialog()
Returns
System.String
The password entered by the user, or an empty string if canceled or no password was entered. |
ShowSignatureDialog(SignatureField)
Shows a dialog displaying information about a signature field and its validation status. Can be canceled through the SignatureDialogShowing event.
Declaration
protected bool ShowSignatureDialog(SignatureField signatureField)
Parameters
SignatureField
signatureField
The signature field to display information about. |
Returns
System.Boolean
True if the dialog was shown or canceled; false if there were no signatures to validate. |
ShowSignaturePanel()
Shows the signature panel if the document contains digital signatures. The panel displays information about the signatures and their validation status.
Declaration
public void ShowSignaturePanel()
ShowSignSignatureDialog(SignatureField)
Shows a dialog allowing the user to sign a signature field in the document. Can be canceled through the SignSignatureDialogShowing event.
Declaration
protected virtual void ShowSignSignatureDialog(SignatureField signatureField)
Parameters
SignatureField
signatureField
The signature field to be signed. |
StartWaiting()
Displays the loading indicator to show that an operation is in progress. Use this method before starting time-consuming operations to provide visual feedback to the user.
Declaration
public void StartWaiting()
StopWaiting()
Hides the loading indicator to show that an operation has completed. Call this method after a time-consuming operation completes to remove the visual feedback.
Declaration
public void StopWaiting()
UnloadDocument()
Unloads the current document and releases all associated resources. Clears document content, disposes all page elements, and resets the viewer state.
Declaration
public void UnloadDocument()
UnwireDocumentEvents()
Called when a document is being unloaded to remove event handlers associated with the document. Disconnects from selection, caret position, annotation, and exception events to prevent memory leaks.
Declaration
protected virtual void UnwireDocumentEvents()
UnwireEvents()
Unwires all event handlers to prevent memory leaks. Removes event handlers related to PDF document importing.
Declaration
protected override void UnwireEvents()
Overrides
UpdateOnMeasure(SizeF)
Updates the element during the measure phase of the layout cycle. Adjusts horizontal scrollbar properties based on content size and scroll state.
Declaration
protected override bool UpdateOnMeasure(SizeF availableSize)
Parameters
System.Drawing.SizeF
availableSize
The available size for the element. |
Returns
System.Boolean
True if the layout should be updated; otherwise, false. |
Overrides
UpdatePresenterLayout()
Updates the layout.
Declaration
public void UpdatePresenterLayout()
Implements
WireDocumentEvents()
Called when a document is being loaded to attach event handlers to the document. Connects to selection, caret position, annotation, and exception events to enable proper document interaction.
Declaration
protected virtual void WireDocumentEvents()
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 finishes loading.
Declaration
public event EventHandler DocumentLoaded
Event Type
System.EventHandler
|
DocumentUnloaded
Fires when the document is unloaded.
Declaration
public event EventHandler DocumentUnloaded
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
|
PasswordRequireDialogShowing
Declaration
public event EventHandler<PasswordRequireDialogShowingEventArgs> PasswordRequireDialogShowing
Event Type
System.EventHandler<PasswordRequireDialogShowingEventArgs>
|
PdfSignaturePanelVisibilityChanged
Occurs when the visibility of the PDF signature panel changes.
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
|
SignatureDialogShowing
Declaration
public event EventHandler<SignatureDialogShowingEventArgs> SignatureDialogShowing
Event Type
System.EventHandler<SignatureDialogShowingEventArgs>
|
SignSignatureDialogShowing
Declaration
public event EventHandler<SignSignatureDialogShowingEventArgs> SignSignatureDialogShowing
Event Type
System.EventHandler<SignSignatureDialogShowingEventArgs>
|
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
|