Click or drag to resize

PdfViewer Properties

The PdfViewer type exposes the following members.

Properties
 NameDescription
Public propertyBrowserExecutableFolder The folder of a fixed version WebView2 Runtime to use instead of the installed Evergreen runtime. Set it before the control is loaded. When not set, a fixed version runtime in a "WebView2Runtime" folder next to the application is used (WebView2Runtime\x64 or WebView2Runtime\x86 for the bitness of the process, or the folder Microsoft's .cab file expands to inside it); without one, the installed Evergreen runtime.
Public propertyCanAssembleDocument Can assemble the document (create bookmarks, thumbnail images or insert, rotate, delete pages). This property has effect when a 128 bit key is used. The default value is true.
Public propertyCanCopyContent Can copy the document content. The viewer honours this permission. The default value is true.
Public propertyCanEditAnnotations Can edit PDF document annotations. The default value is true.
Public propertyCanEditContent Can edit PDF document content. The default value is true.
Public propertyCanFillFormFields Can fill the form fields. This property has effect when a 128 bit key is used. The default value is true.
Public propertyCanPrint Can print the document. The viewer honours this permission. The default value is true.
Public propertyCoreWebView2 The Microsoft Edge WebView2 instance that displays the viewer, for advanced customization (for example browser settings). It is null until the viewer has started; the viewer itself is driven through the members of this control.
Public propertyCurrentPage Gets the page shown in the viewer, or goes to the specified page. The first page in a document is page 1. Set before a document is loaded, the document opens at that page. -1 means the viewer shows the first page.
Public propertyDocumentDisplayMode Gets or sets the display mode of the document to show the page thumbnails, the outline (bookmarks) or the attachments next to the document. The default value is NotSet (the document's own page mode).
Public propertyInstallWebView2RuntimeIfMissing Installs the Evergreen Microsoft Edge WebView2 Runtime when it is missing on the computer: the viewer runs Microsoft's installer (WebView2BootstrapperPath) for the current user, silently, then starts. The default value is false: the viewer shows a message with the download address instead. Set it before the control is loaded.
Public propertyIsDocumentLoaded True when a document is loaded and displayed in the viewer (after DocumentLoaded).
Public propertyKeySize The dimension of the encryption key. By default a 128 bit key is used.
Public propertyLicenseKey Gets or sets the license key
Public propertyOpenPassword The password of a password protected PDF document. It opens the document without asking the user, and it is used to change the viewer preferences and security options of a protected document. When it is not set (or not correct), PasswordRequired is raised; when the application does not give the password there, the viewer asks the user for it.
Public propertyOwnerPassword The password required to change permissions of the PDF document like printing or editing. The default value is an empty string. If the OwnerPassword property is an empty string and the UserPassword is not empty, an owner password is generated, so the permissions cannot be changed by opening the document with the user password.
Public propertyPageCount Gets the page count of the currently loaded PDF document, or -1 when no document is loaded.
Public propertyPageFitMode Gets or sets the fit mode of the PDF page in the viewer. The default value is NotSet.
Public propertyPageLayoutMode Gets or sets the layout mode for a page view. The default value is NotSet.
Public propertyPdfSecurityOptions Gets a reference to the object controlling the PDF document security settings like user and owner password, and restricting printing or copying of the displayed document. The viewer honours the printing and copying permissions. The settings take effect for the next document loaded (or after ReloadPdfDocument).
Public propertyPdfViewerPreferences Gets a reference to the object controlling the PDF document viewer preferences. The properties of this object allow you to hide the toolbar and the navigation panel, and to change the page mode and the page layout of the document. They are written into the displayed document, and take effect for the next document loaded (or after ReloadPdfDocument).
Public propertyShowDocumentPropertiesButton Show or hide the document properties command of the viewer. The default value is true.
Public propertyShowDownloadButton Show or hide the download (save a copy) button of the toolbar (and Ctrl+S). The default value is true.
Public propertyShowFindButton Show or hide the find button of the toolbar and its find bar (and Ctrl+F). Find(String, Boolean, Boolean) works either way. The default value is true.
Public propertyShowNavigationPanel Show or hide the navigation panel on the left side of the viewer, with the page thumbnails, the document outline (bookmarks) and the attachments. The default value of this property is true. This property is a shortcut for the PdfViewerPreferences.HideWindowUI.
Public propertyShowOpenButton Show or hide the open file command of the viewer (in the tools menu of the toolbar; Ctrl+O): the user can open another PDF file from the computer in the viewer. A document the user opens is only displayed: ReloadPdfDocument reloads the document loaded by the application. The default value is false.
Public propertyShowPageNavigationButtons Show or hide the page navigation of the toolbar (previous page, next page, the page number box and the first and last page commands). The default value is true.
Public propertyShowPresentationModeButton Show or hide the presentation mode (full screen) command of the viewer. The default value is true.
Public propertyShowPrintButton Show or hide the print button of the toolbar (and Ctrl+P). The print methods of the control work either way; printing also depends on the document permissions (CanPrint). The default value is true.
Public propertyShowScrollbars Show or hide the viewer scrollbars. The document can still be scrolled with the mouse wheel and the keyboard. The default value is true.
Public propertyShowSidebarButton Show or hide the toolbar button that opens and closes the navigation panel (the panel itself can still be shown with DocumentDisplayMode). The default value is true.
Public propertyShowToolbarMode Show or hide the viewer toolbar. The default value is NotSet (the toolbar is shown).
Public propertyShowZoomButtons Show or hide the zoom buttons and the zoom list of the toolbar. The default value is true.
Public propertySource The path of the PDF file displayed in the viewer. Setting it loads the file (like LoadFile(String)).
Public propertyUserDataFolder The folder where the viewer keeps its browser data (cache, settings). Set it before the control is loaded. When not set, a folder under the local application data folder (ExpertPdf\PdfViewer\WebView2) is used. A viewer that uses a fixed version runtime gets a folder of its own (WebView2-<hash> next to it): WebView2 cannot share one folder between runtimes. When the folder is in use by WebView2 with other settings (another application), the viewer uses a folder of the application's own, and a viewer whose window has another DPI awareness than the first viewer of the process (a Windows Forms application becomes DPI aware when it first shows WPF content) uses WebView2-dpi-<awareness> next to it. A folder set here is always used as it is: give viewers with different settings different folders.
Public propertyUserPassword The password required to open the PDF document. The viewer asks the user for it. The default value is an empty string.
Public propertyViewerTheme Gets or sets the color theme of the viewer: light, dark, or as set in Windows (the default). The pages of the document keep their own colors.
Public propertyStatic memberWebView2BootstrapperPath The Microsoft Edge WebView2 Runtime installer (bootstrapper) used by InstallWebView2Runtime and InstallWebView2RuntimeIfMissing. The default value is MicrosoftEdgeWebview2Setup.exe in the application folder, where the NuGet package of the viewer puts it.
Public propertyZoomPercentage Gets or sets the zoom percentage of the viewer. For example, 100 represents a magnification of 100%. Reading it gives the zoom of the viewer (it changes when the user zooms, or with the fit modes). A negative value means the default zoom is used. The default value is -1.
Top
See Also