Skip to content

PdfDocumentView Class

Definition

Namespace: Xfinium.Pdf.View

Defines a viewer control for PDF files.

C#
public class PdfDocumentView : UserControl, IResource, IAnimatable, IInputElement, IFrameworkInputElement, ISupportInitialize, IHaveResources, IQueryAmbient, IAddChild, IDisposable, IPdfView, IComponentConnector

Inheritance: Object → DispatcherObject → DependencyObject → Visual → UIElement → FrameworkElement → Control → ContentControl → UserControl → PdfDocumentView

Implements: IResource, IAnimatable, IInputElement, IFrameworkInputElement, ISupportInitialize, IHaveResources, IQueryAmbient, IAddChild, IDisposable, IPdfView, IComponentConnector

Remarks

Use this control to display PDF files in Windows Presentation Foundation applications. Set the Document property to display the desired PDF document. Set the Zoom property to adjust the zoom level. Use the PageDisplayLayout property to specify how the pages are arranged in the viewer. The UserInteractionMode property can be used to specify how the user interacts with the PDF document displayed in the viewer.

Example

In your window's constructor connect the document view to a PdfVisualDocument:

C#
1
2
3
4
5
6
7
8
9
public MainWindow()
{
    // ...

    document = new PdfVisualDocument();
    documentView.Document = document;

    // ...
}
When the window is closed, the viewer control need to be disposed explicitly as follows:
C#
1
2
3
4
5
6
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
    document.Close();
    documentView.Dispose();
    document.Dispose();
}

Constructor

Name Description
PdfDocumentView() Initializes a new PdfDocumentView object.

Fields

Name Description
ResizeHandleStyleProperty ShowAnnotationsCustomizationMenu Dependency Property
RestrictAnnotationsToVisiblePageAreaProperty RestrictAnnotationsToVisiblePageArea Dependency Property
ShowAnnotationsProperty ShowAnnotations Dependency Property
ShowDefaultAnnotationContextMenuProperty ShowDefaultAnnotationContextMenu Dependency Property
ShowDefaultPageContextMenuProperty ShowDefaultPageContextMenu Dependency Property
ShowFormFieldsProperty ShowAnnotations Dependency Property
ShowPageNumberIndicatorProperty Zoom Dependency Property
ZoomProperty Zoom Dependency Property

Properties

Name Description
AnnotationSelectionRectangleAppearance Gets or sets the appearance of the annotation selection rectangle.
AnnotationToolTips Gets or sets the annotation tooltips.
DefaultCircleAnnotationAppearance Gets or sets the default appearance of the circle annotation.
DefaultCloudSquareAnnotationAppearance Gets or sets the default appearance of the cloud square annotation.
DefaultFileAttachmentAnnotationAppearance Gets or sets the default appearance of the file attachment annotation.
DefaultFormFieldAppearance Gets or sets the default appearance of the form fields.
DefaultFreeTextAnnotationAppearance Gets or sets the default appearance of the free text annotation.
DefaultHighlightAnnotationAppearance Gets or sets the default appearance of the highlight annotation.
DefaultInkAnnotationAppearance Gets or sets the default appearance of the ink annotation.
DefaultLineAnnotationAppearance Gets or sets the default appearance of the line annotation.
DefaultLinkAnnotationAppearance Gets or sets the default appearance of the link annotation.
DefaultPolylineAnnotationAppearance Gets or sets the default appearance of the polyline annotation.
DefaultRubberStampAnnotationAppearance Gets or sets the default appearance of the rubber stamp annotation.
DefaultSquareAnnotationAppearance Gets or sets the default appearance of the square annotation.
DefaultSquigglyAnnotationAppearance Gets or sets the default appearance of the squiggly annotation.
DefaultStrikeoutAnnotationAppearance Gets or sets the default appearance of the strikeout annotation.
DefaultTextAnnotationAppearance Gets or sets the default appearance of the text annotation.
DefaultUnderlineAnnotationAppearance Gets or sets the default appearance of the underline annotation.
Document Gets or sets the document displayed in the viewer.
FormDesigner Gets the active form designer.
GraphicRendererFactory Gets or sets the graphic renderer factory.
PageDisplayLayout Gets or sets the current page display layout.
PageNumber Gets or sets the page number.
ResizeHandleStyle Gets or sets the style of the resize handles for annotations.
RestrictAnnotationsToVisiblePageArea Gets or sets a flag indicating whether annotations can be added or moved only in the visible page area.
SelectionRectangleAppearance Gets or sets the appearance of the selection rectangle.
ShowAnnotations Gets or sets a value indicating whether the annotations should be displayed or not.
ShowDefaultAnnotationContextMenu Gets of sets a flag indicating whether the default annotation context menu should be displayed when right-clicking on an annotation.
ShowDefaultPageContextMenu Gets of sets a flag indicating whether the default page context menu should be displayed when right-clicking on a page.
ShowFormFields Gets or sets a value indicating whether the annotations should be displayed or not.
ShowPageNumberIndicator Shows or hides the page number indicator in the bottom left corner of the PdfDocumentView control.
TextSearchResultAppearance Gets or sets the appearance used for highlighting the text search results.
TextSelectionAppearance Gets or sets the appearance of the text selection.
UserInteractionMode Gets or sets the user interaction mode.
Zoom Gets or sets the zoom level.
ZoomMode Gets or sets the current zoom mode.

Methods

Name Description
Dispose Disposes the viewer control.
GetSelectedAnnotations Gets the collection of selected annotations in the control.
InitializeComponent InitializeComponent
ScrollToPageLocation Scrolls the viewer to the specified page at the given location.
UpdateOnDpiChange Updates the viewer content when the monitor dpi changes.

Events

Name Description
ZoomChanged Gets or sets the event that is fired when the zoom has changed.
ZoomModeChanged Gets or sets the event that is fired when the ZoomMode has changed.
UserInteractionModeChanged Gets or sets the event that is fired when the UserInteractionMode has changed.
PageNumberChanged Gets or sets the event that is fired when the page number has changed.
PageClick Gets or sets the event that is fired when a page has been clicked.
PageDoubleClick Gets or sets the event that is fired when a page has been double clicked.
PageContextMenu Gets or sets the event that is fired when a page context menu should be displayed.
BeforePageDelete Gets or sets the event that is fired when a page is about to be deleted using the default page context menu.
AfterPageDelete Gets or sets the event that is fired after a page has been deleted.
PageRenderingStarted Gets or sets the event that is fired when a page begins to be displayed.
PageRenderingCompleted Gets or sets the event that is fired when the page content for the page visible area is displayed in full.
PageRenderingCancelled Gets or sets the event that is fired when the page stops displaying content.
AnnotationClick Gets or sets the event that is fired when an annotation has been clicked.
AnnotationDoubleClick Gets or sets the event that is fired when an annotation has been double clicked.
AnnotationContextMenu Gets or sets the event that is fired when an annotation context menu should be displayed.
AnnotationToolTipContentRequested Gets or sets the event that is fired when content is needed for annotation tooltip.
AnnotationToolTipPopup Gets or sets the event that is fired before an annotation tooltip is displayed.
BeforeLinkExecute Gets or sets the event that is fired before a link is executed.
AfterLinkExecute Gets or sets the event that is fired after a link has been executed.
AnnotationSelected Gets or sets the event that is fired when an annotation is selected the PdfDocumentView control.
AnnotationDeselected Gets or sets the event that is fired when an annotation is deselected the PdfDocumentView control.
BeforeAnnotationAdd Gets or sets the event that is fired before an annotation is added through the PdfDocumentView control.
AfterAnnotationAdd Gets or sets the event that is fired after an annotation has been added through the PdfDocumentView control.
BeforeAnnotationMove Gets or sets the event that is fired when an annotation is about to be moved.
AfterAnnotationMove Gets or sets the event that is fired after an annotation has been moved.
BeforeAnnotationResize Gets or sets the event that is fired when an annotation is about to be resized.
AfterAnnotationResize Gets or sets the event that is fired after an annotation has been resized.
BeforeAnnotationDelete Gets or sets the event that is fired when an annotation is about to be deleted using the DEL key.
AfterAnnotationDelete Gets or sets the event that is fired after an annotation has been deleted.
AfterContentSelect Gets or sets the event that is fired after content has been selected on the page.
SelectedContentContextMenu Gets or sets the event that is fired when a context menu should be displayed for selected content.
BeforeFieldAdd Gets or sets the event that is fired before a form field is added through the PdfDocumentView control.
AfterFieldAdd Gets or sets the event that is fired after a form field has been added through the PdfDocumentView control.