Class PdfView

This XAML control displays a PDF.

Inheritance
System.Object
Windows.UI.Xaml.DependencyObject
Windows.UI.Xaml.UIElement
Windows.UI.Xaml.FrameworkElement
Windows.UI.Xaml.Controls.Control
PdfView
Implements
Windows.UI.Composition.IAnimationObject
Namespace: PSPDFKit.UI
Assembly: PSPDFKit.dll
Syntax
public sealed class PdfView : Control, IDependencyObject, IDependencyObject2, IUIElement, IUIElement2, IUIElement3, IUIElement4, IUIElement5, IUIElement7, IUIElement8, IUIElement9, IUIElementOverrides, IUIElementOverrides7, IUIElementOverrides8, IUIElementOverrides9, IAnimationObject, IFrameworkElement, IFrameworkElement2, IFrameworkElement3, IFrameworkElement4, IFrameworkElement6, IFrameworkElement7, IFrameworkElementProtected7, IFrameworkElementOverrides, IFrameworkElementOverrides2, IControl, IControl2, IControl3, IControl4, IControl5, IControl7, IControlProtected, IControlOverrides, IControlOverrides6

Constructors

PdfView()

Default constructor.

Declaration
public PdfView()

Properties

AutoSave

Automatically save the file when the PdfView is unloaded or a new file is loaded. Default is None.

Declaration
public AutoSaveMode AutoSave { get; set; }
Property Value
Type Description
AutoSaveMode

Controller

The UI controller for the currently opened Document

Declaration
public Controller Controller { get; }
Property Value
Type Description
Controller

Css

Custom CSS for the PdfView

Declaration
public Uri Css { get; set; }
Property Value
Type Description
Windows.Foundation.Uri

Document

The currently opened Document.

Declaration
public Document Document { get; }
Property Value
Type Description
Document

License

The PSPDFKit license key.

Declaration
public string License { get; set; }
Property Value
Type Description
System.String

MessageBoxImage

MessageBox image.

Declaration
public BitmapImage MessageBoxImage { get; set; }
Property Value
Type Description
Windows.UI.Xaml.Media.Imaging.BitmapImage

MessageBoxText

MessageBox text.

Declaration
public string MessageBoxText { get; set; }
Property Value
Type Description
System.String

MessageBoxVisibility

Visibility of the MessageBox.

Declaration
public Visibility MessageBoxVisibility { get; set; }
Property Value
Type Description
Windows.UI.Xaml.Visibility

PdfFileSource

A Windows.Storage.StorageFile representing a document to open.

Declaration
public StorageFile PdfFileSource { get; set; }
Property Value
Type Description
Windows.Storage.StorageFile

PdfFileSourceProperty

The file source as a Windows.Storage.StorageFile.

Declaration
public static DependencyProperty PdfFileSourceProperty { get; }
Property Value
Type Description
Windows.UI.Xaml.DependencyProperty

PdfUriSource

A representing a document to open.

Declaration
public System.Uri PdfUriSource { get; set; }
Property Value
Type Description
System.Uri

PdfUriSourceProperty

The file source as a .

Declaration
public static DependencyProperty PdfUriSourceProperty { get; }
Property Value
Type Description
Windows.UI.Xaml.DependencyProperty

PreventTextCopy

When copying of text is disabled, it's still possible to select text but copying either using the shortcut or a context menu will have no effect. Changing this property has no effect after a document has loaded. Load the document again if you wish to update this property.

Declaration
public bool PreventTextCopy { get; set; }
Property Value
Type Description
System.Boolean

ReadOnly

Make the document read only if set to true.

Declaration
public bool ReadOnly { get; set; }
Property Value
Type Description
System.Boolean

ResetViewStatePropertiesOnLoad

Determines how the ViewState is reset or not before loading a new document.

Declaration
public ResetViewStateMode ResetViewStatePropertiesOnLoad { get; set; }
Property Value
Type Description
ResetViewStateMode

ShowAnnotations

Show or hide annotations.

Declaration
public bool ShowAnnotations { get; set; }
Property Value
Type Description
System.Boolean

ShowToolbar

Show or hide the UI Toolbar.

Declaration
public bool ShowToolbar { get; set; }
Property Value
Type Description
System.Boolean

SidebarPlacement

Declaration
public SidebarPlacement SidebarPlacement { get; set; }
Property Value
Type Description
SidebarPlacement

WebViewVisibility

Visibility of the WebView.

Declaration
public Visibility WebViewVisibility { get; set; }
Property Value
Type Description
Windows.UI.Xaml.Visibility

Methods

GetToolbarItems()

Gets the IToolbarItems shown.

Declaration
public IList<IToolbarItem> GetToolbarItems()
Returns
Type Description
IList<IToolbarItem>

Current list of toolbar items

HighlightResultsAsync(IEnumerable<Result>)

Highlights the search results in the UI. Pass an empty list to highlight nothing.

Declaration
public IAsyncAction HighlightResultsAsync(IEnumerable<Result> results)
Parameters
Type Name Description
IEnumerable<Result> results

The collection of results to highlight.

Returns
Type Description
Windows.Foundation.IAsyncAction

OnApplyTemplate()

Windows.UI.Xaml.FrameworkElement.Windows.UI.Xaml.IFrameworkElementOverrides.OnApplyTemplate()
Declaration
protected override void OnApplyTemplate()
Overrides
Windows.UI.Xaml.FrameworkElement.Windows.UI.Xaml.IFrameworkElementOverrides.OnApplyTemplate()

OpenStorageFileAsync(StorageFile)

Asynchronously Open a PDF document represented by a Windows.Storage.StorageFile

Declaration
public IAsyncAction OpenStorageFileAsync(StorageFile file)
Parameters
Type Name Description
Windows.Storage.StorageFile file

The Windows.Storage.StorageFile representing the PDF.

Returns
Type Description
Windows.Foundation.IAsyncAction

OpenStorageFileWithPasswordAsync(StorageFile, String)

Asynchronously Open a PDF document represented by a Windows.Storage.StorageFile

Declaration
public IAsyncAction OpenStorageFileWithPasswordAsync(StorageFile file, string password)
Parameters
Type Name Description
Windows.Storage.StorageFile file

The Windows.Storage.StorageFile representing the PDF.

System.String password

The password required to open the PDF.

Returns
Type Description
Windows.Foundation.IAsyncAction

OpenUriAsync(Uri)

Asynchronously Open a PDF document represented by a

Declaration
public IAsyncAction OpenUriAsync(Uri uri)
Parameters
Type Name Description
Windows.Foundation.Uri uri

The representing the PDF.

Returns
Type Description
Windows.Foundation.IAsyncAction

OpenUriAsync(Uri, String)

Asynchronously Open a PDF document represented by a

Declaration
public IAsyncAction OpenUriAsync(Uri uri, string password)
Parameters
Type Name Description
Windows.Foundation.Uri uri

The representing the PDF.

System.String password

The password required to open the PDF.

Returns
Type Description
Windows.Foundation.IAsyncAction

ResetAsync()

Resets the WebView to it's initial state

Declaration
public IAsyncAction ResetAsync()
Returns
Type Description
Windows.Foundation.IAsyncAction

SetToolbarItemsAsync(IList<IToolbarItem>)

Sets the IToolbarItems to be show. This will overwrite any items currently held by the toolbar. If the view is not initialized, the item will be cached and set when the view is ready.

Declaration
public IAsyncAction SetToolbarItemsAsync(IList<IToolbarItem> toolbarItems)
Parameters
Type Name Description
IList<IToolbarItem> toolbarItems
Returns
Type Description
Windows.Foundation.IAsyncAction

ShowMessage(String)

Hides the currently displayed PDF, if any, and shows a message.

Declaration
public void ShowMessage(string message)
Parameters
Type Name Description
System.String message

The message to show.

Events

InitializationCompletedHandler

The event handler invoked once the PdfView has completed initialization.

Declaration
public event TypedEventHandler<PdfView, Document> InitializationCompletedHandler
Event Type
Type Description
Windows.Foundation.TypedEventHandler<PdfView, Document>

OnDocumentOpened

The event handler invoked whenever a document is opened.

Declaration
public event TypedEventHandler<PdfView, Document> OnDocumentOpened
Event Type
Type Description
Windows.Foundation.TypedEventHandler<PdfView, Document>

OnFileExported

This event handler is invoked whenever a document is exported successfully to a Windows.Storage.StorageFile.

Declaration
public event TypedEventHandler<PdfView, StorageFile> OnFileExported
Event Type
Type Description
Windows.Foundation.TypedEventHandler<PdfView, Windows.Storage.StorageFile>

OnFileExportFailed

This event handler is invoked whenever a document failed to export to a Windows.Storage.StorageFile.

Declaration
public event TypedEventHandler<PdfView, Exception> OnFileExportFailed
Event Type
Type Description
Windows.Foundation.TypedEventHandler<PdfView, Exception>

OnSuspendUnloading

The event handler is invoked whenever the PdfView is about to unload and suspends closing of the document. You must call Completed on the Windows.Foundation.Deferral once finished.

Declaration
public event TypedEventHandler<PdfView, Deferral> OnSuspendUnloading
Event Type
Type Description
Windows.Foundation.TypedEventHandler<PdfView, Windows.Foundation.Deferral>

OnViewModeChange

Event handler for the PdfViewMode changes.

Declaration
public event TypedEventHandler<PdfView, PdfViewModeChange> OnViewModeChange
Event Type
Type Description
Windows.Foundation.TypedEventHandler<PdfView, PdfViewModeChange>

OnWatermarkRequested

Use this event handler to set a Watermark for the view. In the handler set the watermark property ViewWatermark. You must call Completed on the Windows.Foundation.Deferral once finished.

Declaration
public event TypedEventHandler<Controller, Deferral> OnWatermarkRequested
Event Type
Type Description
Windows.Foundation.TypedEventHandler<Controller, Windows.Foundation.Deferral>

Implements

Windows.UI.Composition.IAnimationObject