Edit this page

Document Presenters

This article will help you get familiar with the concept of a document presenter in RadPDFViewer.

What Is a Document Presenter

The document presenter is responsible for displaying the pages of the document, navigating in it, managing the selection markers, conversion between view coordinates and document location coordinates, plus proper response to mouse and touch events.

RadPdfViewer provides two presenters out of the box:

  • FixedDocumentPagesPresenter

  • FixedDocumentSinglePageViewPresenter

Both of those presenters inherit the abstract Telerik.Windows.Documents.UI.FixedDocumentPresenterBase class, which implements the Telerik.Windows.Documents.UI.IFixedDocumentPresenter interface.

You can access the document presenter in RadPdfViewer by accessing the FixedDocumentPresenter property.

FixedDocumentPresenterBase exposes the VisiblePagesCacheOffset property, which you can use to control the amount of pages that are cached before and after the visible ones. The default value of VisiblePagesCacheOffset is 1.

Using FixedDocumentPagesPresenter

This document presenter displays the pages in a vertical order and is used by default by RadPdfViewer. There is a fixed margin between the pages, and each pages is centered horizontally inside the RadPdfViewer viewport. The code from Example 1 shows how to set it as the currently used presenter.

[C#] Example 1: Using FixedDocumentPagesPresenter

this.radPdfViewer.FixedDocumentPresenter = this.radPdfViewer.GetRegisteredPresenter(FixedDocumentPresenterNames.FixedDocumentPagesPresenter);

Figure 1: FixedDocumentPagesPresenter

Rad Pdf Viewer Ui Document Presenters 01

Using FixedDocumentSinglePageViewPresenter

This document presenter displays a single page inside the viewport. The page is vertically and horizontally centered. Example 2 shows how to set the FixedDocumentSinglePageViewPresenter as the currently used presenter.

[C#] Example 2: Using FixedDocumentSinglePageViewPresenter

this.radPdfViewer.FixedDocumentPresenter = this.radPdfViewer.GetRegisteredPresenter(FixedDocumentPresenterNames.FixedDocumentSinglePageViewPresenter);

Figure 2: FixedDocumentSinglePageViewPresenter

Rad Pdf Viewer Ui Document Presenters 02

See Also