Class PdfView

This XAML control displays a PDF.

Inheritance
System.Object
PdfView
Namespace: PSPDFKit.UI
Assembly: PSPDFKit.dll
Syntax
public sealed class PdfView : Control

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
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
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
Visibility

PdfFileSource

A representing a document to open.

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

PdfFileSourceProperty

The file source as a .

Declaration
public static DependencyProperty PdfFileSourceProperty { get; }
Property Value
Type Description
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
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
Visibility

Methods

GetToolbarItems()

Gets the IToolbarItems shown.

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

Current list of toolbar items

HighlightResultsAsync(IEnumerable<IResult>)

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

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

The collection of results to highlight.

Returns
Type Description
IAsyncAction

OnApplyTemplate()

Declaration
protected override void OnApplyTemplate()

OpenStorageFileAsync(StorageFile)

Asynchronously Open a PDF document represented by a

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

The representing the PDF.

Returns
Type Description
IAsyncAction

OpenStorageFileWithPasswordAsync(StorageFile, String)

Asynchronously Open a PDF document represented by a

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

The representing the PDF.

System.String password

The password required to open the PDF.

Returns
Type Description
IAsyncAction

OpenUriAsync(Uri)

Asynchronously Open a PDF document represented by a

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

The representing the PDF.

Returns
Type Description
IAsyncAction

OpenUriAsync(Uri, String)

Asynchronously Open a PDF document represented by a

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

The representing the PDF.

System.String password

The password required to open the PDF.

Returns
Type Description
IAsyncAction

ResetAsync()

Resets the WebView to it's initial state

Declaration
public IAsyncAction ResetAsync()
Returns
Type Description
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
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
TypedEventHandler<PdfView, Document>

OnDocumentOpened

The event handler invoked whenever a document is opened.

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

OnFileExported

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

Declaration
public event TypedEventHandler<PdfView, StorageFile> OnFileExported
Event Type
Type Description
TypedEventHandler<PdfView, StorageFile>

OnFileExportFailed

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

Declaration
public event TypedEventHandler<PdfView, Exception> OnFileExportFailed
Event Type
Type Description
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 once finished.

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

OnViewModeChange

Event handler for the PdfViewMode changes.

Declaration
public event TypedEventHandler<PdfView, PdfViewModeChange> OnViewModeChange
Event Type
Type Description
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 once finished.

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