Skip to content

PdfDocumentView Class

Definition

Namespace: Xfinium.Pdf.View

Defines a viewer control for PDF files.

C#
public class PdfDocumentView : Control, IComponent, IDisposable, IOleControl, IOleObject, IOleInPlaceObject, IOleInPlaceActiveObject, IOleWindow, IViewObject, IViewObject2, IPersist, IPersistStreamInit, IPersistPropertyBag, IPersistStorage, IQuickActivate, ISupportOleDropSource, IDropTarget, ISynchronizeInvoke, IWin32Window, IArrangedElement, IBindableComponent, IKeyboardToolTip, IHandle, IPdfView

Inheritance: Object → MarshalByRefObject → Component → Control → PdfDocumentView

Implements: IComponent, IDisposable, IOleControl, IOleObject, IOleInPlaceObject, IOleInPlaceActiveObject, IOleWindow, IViewObject, IViewObject2, IPersist, IPersistStreamInit, IPersistPropertyBag, IPersistStorage, IQuickActivate, ISupportOleDropSource, IDropTarget, ISynchronizeInvoke, IWin32Window, IArrangedElement, IBindableComponent, IKeyboardToolTip, IHandle, IPdfView

Remarks

Use this control to display PDF files. 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 form's constructor connect the document view to a PdfVisualDocument:

C#
public AppForm()
{
    InitializeComponent();

    // ...

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

    // ...
}
When the form is closed, the viewer control need to be disposed explicitly as follows:
C#
1
2
3
4
5
6
7
8
protected override void OnFormClosing(FormClosingEventArgs e)
{
    base.OnFormClosing(e);

    document.Close();
    documentView.Dispose();
    document.Dispose();
}

Constructor

Name Description
PdfDocumentView() Initializes a new PdfDocumentView object.

Properties

Name Description
AnnotationSelectionRectangleAppearance Gets or sets the appearance of the annotation selection rectangle.
AnnotationToolTips Gets or sets the annotation tooltips.
ContentPosition Gets the content position.
ContentSize Gets the content size.
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.
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 annotations 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 form fields should be displayed or not.
ShowPageNumberIndicator Shows or hides the page number indicator in the bottom left corner of the PdfDocumentView control.
TextSearchResultColor Gets or sets the color 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
ConvertPagePointToViewerPoint Converts a page point in page visual coordinates to a viewer point in viewer coordinates.
GetSelectedAnnotations Gets the collection of selected annotations in the control.
GetVisiblePages Gets the list of visible pages.
ScrollToPageLocation Scrolls the viewer to the specified page at the given location.

Events

Name Description
ContentPainted Gets or sets the event that is fired after the viewer content has been drawn.
ContentPositionChanged Gets or sets the event that is fired when the content position has changed.
ContentSizeChanged Gets or sets the event that is fired when the size of displayed content changes.
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.
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 or the default content menu.
AfterAnnotationDelete Gets or sets the event that is fired after an annotation has been deleted.
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.
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.