Pdf |
The PdfViewer type exposes the following members.
| Name | Description | |
|---|---|---|
| AllowDownload | Show or hide the download (save) button of the viewer toolbar. The default value is true. | |
| AllowPrint | Show or hide the print button of the viewer toolbar. Printing also depends on the document permissions. The default value is true. | |
| ClientScriptUrl | The address of the client script ("~/expertpdf-viewer.ashx/expertpdf-viewer-client.js"), resolved for the page. Include it in the page to drive the viewer from JavaScript with ExpertPdfViewer.get(id). | |
| CurrentPage | The page the document opens at. The first page in a document is page 1. A negative value means the viewer shows the first page. The default value is -1. | |
| DocumentDisplayMode | 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). | |
| LicenseKey | Gets or sets the license key | |
| OpenPassword | The password of a password protected PDF document. It is used to apply the viewer preferences and security options to a protected document. The viewer asks the user for the password of a protected document, unless the page gives it with the "passwordrequired" event of the client script. | |
| PageFitMode | Gets or sets the fit mode of the PDF page in the viewer: the whole page (Fit), the page width (FitH) or the page height (FitV). The default value is NotSet. | |
| PageLayoutMode | Gets or sets the layout of the pages in the viewer. The default value is OneColumn. This property also sets the page layout in the document viewer preferences. | |
| PdfSecurityOptions | 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. | |
| PdfSourceBytes | The PDF document to be displayed in the viewer. It is kept in the session state (when the session state is enabled) so it is displayed again after a postback. | |
| PdfSourceURL | The address of the PDF document to be displayed in the viewer: an absolute URL, or an application relative one ("~/files/document.pdf"). If PdfSourceBytes is set, this property is ignored. | |
| PdfViewerPreferences | Gets a reference to the object controlling the PDF document viewer preferences (hide the toolbar or the navigation panel, page mode and page layout). The preferences are written into the displayed document. | |
| ShowDocumentPropertiesButton | Show or hide the document properties command of the viewer. The default value is true. | |
| ShowFindButton | Show or hide the find button of the toolbar and its find bar (and Ctrl+F). The find methods of the client script work either way. The default value is true. | |
| ShowNavigationPanel | 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. | |
| ShowOpenButton | Show or hide the open file command of the viewer (in the tools menu of the toolbar; Ctrl+O): the user can open a PDF file from the computer in the viewer (it is not sent to the server). The default value is false. | |
| ShowPageNavigationButtons | 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. | |
| ShowPresentationModeButton | Show or hide the presentation mode (full screen) command of the viewer. The default value is true. | |
| ShowScrollbars | Show or hide the viewer scrollbars. The document can still be scrolled with the mouse wheel and the keyboard. The default value is true. | |
| ShowSidebarButton | 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. | |
| ShowToolbarMode | Show or hide the viewer toolbar. The default value is NotSet (the toolbar is shown). | |
| ShowZoomButtons | Show or hide the zoom buttons and the zoom list of the toolbar. The default value is true. | |
| ViewerTheme | Gets or sets the color theme of the viewer: light, dark, or as set in the browser of the user (the default). The pages of the document keep their own colors. | |
| ZoomPercentage | Gets or sets the zoom percentage of the viewer. For example, 100 represents a magnification of 100%. A negative value means the default zoom is used. The default value is -1. |
| Name | Description | |
|---|---|---|
| AddAttributesToRender |
Adds the viewer address and the size of the viewer frame.
(Overrides WebControlAddAttributesToRender(HtmlTextWriter)) | |
| GetPageCount | A fast method to obtain the page count of a specified PDF document. | |
| Render |
Renders the design time placeholder, or the viewer.
(Overrides WebControlRender(HtmlTextWriter)) | |
| RenderContents |
The viewer frame has no content.
(Overrides WebControlRenderContents(HtmlTextWriter)) |
The control displays a PDF document in the page with a built-in viewer that works in every modern browser: page thumbnails, outline (bookmarks) and attachments panels, text search and selection, zoom, page layouts and printing. No browser plug-in is needed.
Set PdfSourceURL to display a document from an address, or PdfSourceBytes to display a document you have in memory (for example one you just created or converted). The viewer files are served by the control itself under the "expertpdf-viewer.ashx" address of the application; no configuration is needed (the IIS application pool must run in the Integrated pipeline mode, the default).
The page can drive the viewer from JavaScript: include "expertpdf-viewer.ashx/expertpdf-viewer-client.js" (see ClientScriptUrl) and use ExpertPdfViewer.get("ClientID") (navigation, zoom, find, theme, toolbar buttons, the password of a protected document).