|
| 1 | +--- |
| 2 | +title: PDF Viewer |
| 3 | +page_title: Configuration, methods and events of Kendo UI Pdf Viewer |
| 4 | +description: Display PDF files in the browser. |
| 5 | +res_type: api |
| 6 | +component: pdfviewer |
| 7 | +--- |
| 8 | + |
| 9 | +# kendo.ui.PDFViewer |
| 10 | + |
| 11 | +Kendo UI PDF Viewer is used to display a PDF file in the browser. It provides ability to choose the PDF library used for processing. If processing option is set, pdfjs is used for processing. The viewer supports: |
| 12 | + |
| 13 | +* `DPL` |
| 14 | +* `PDF.JS` |
| 15 | + |
| 16 | +## Configuration |
| 17 | + |
| 18 | +### dplProcessing `Object` |
| 19 | + |
| 20 | +Specifies the DPL configuration options. |
| 21 | + |
| 22 | +### dplProcessing.read `Object` |
| 23 | + |
| 24 | +Specifies the configuration of the jQuery.ajax to make an HTTP request to the remote service. |
| 25 | + |
| 26 | +### dplProcessing.read.url `String` |
| 27 | + |
| 28 | +Specifies the url to which the request is sent. |
| 29 | + |
| 30 | +### dplProcessing.read.pageField `String` *(default: 'pageNumber')* |
| 31 | + |
| 32 | +Specifies the page field parameter submitted to the read url. It is used in scenario with `loadOnDemand` when requests are sent for each page. |
| 33 | + |
| 34 | +### dplProcessing.read.type `String` *(default: 'GET')* |
| 35 | +Specifies the type of the request. |
| 36 | + |
| 37 | +### dplProcessing.read.dataType `String` |
| 38 | +The type of result expected from the server. Used values are "json" and "jsonp". The PDFViewer expects a json to render the geometries. |
| 39 | + |
| 40 | +### dplProcessing.upload `Object` |
| 41 | +Specifies the configuration of the jQuery.ajax to make an HTTP POST request to the remote service. |
| 42 | + |
| 43 | +### dplProcessing.upload.url `String` |
| 44 | +Specifies the url that will receive the submitted file. The handler must accept `POST` requests. |
| 45 | + |
| 46 | +### dplProcessing.upload.saveField `String` |
| 47 | +Specifies the name of the form field which is submitted to saveUrl. |
| 48 | + |
| 49 | +### dplProcessing.download `Object` |
| 50 | +Specifies the download configuration. |
| 51 | + |
| 52 | +### dplProcessing.download.url `String` |
| 53 | +Specifies the download action url that will be navigated to. |
| 54 | + |
| 55 | +### dplProcessing.loadOnDemand `Boolean` *(default: false)* |
| 56 | +Specifies whether read requests should be sent for each page. |
| 57 | + |
| 58 | +### pdfjsProcessing `Object` |
| 59 | + |
| 60 | +Specifies the PDF.JS configuration options. |
| 61 | + |
| 62 | +### pdfjsProcessing.file `Blob | byte[] | String` |
| 63 | + |
| 64 | +Specifies the default file to be displayed. |
| 65 | + |
| 66 | +### width `Number|String` *(default: 800)* |
| 67 | + |
| 68 | +The selected page number in the viewer. |
| 69 | + |
| 70 | +### height `Number|String` *(default: 1200)* |
| 71 | + |
| 72 | +The selected page number in the viewer. |
| 73 | + |
| 74 | +### page `Number` *(default: 1)* |
| 75 | + |
| 76 | +The selected page number in the viewer. |
| 77 | + |
| 78 | +### view `Object` *(default: 1)* |
| 79 | + |
| 80 | +Defines the page surface options. |
| 81 | + |
| 82 | +### view.type `String` *(default: "canvas")* |
| 83 | + |
| 84 | +Defines the surface type. It accepts `canvas` or `svg`. This option is supported only for DPL. |
| 85 | + |
| 86 | +#### Example - customizing the type of pages' surfaces |
| 87 | + |
| 88 | + <div id="pdf-viewer"></div> |
| 89 | + <script> |
| 90 | + $("#pdfviewer").kendoPdfViewer({ |
| 91 | + view: { |
| 92 | + type: "svg" |
| 93 | + } |
| 94 | + }); |
| 95 | + </script> |
| 96 | + |
| 97 | +### toolbar `Boolean|Object` *(default: true)* |
| 98 | + |
| 99 | +Toolbar option accepts a Boolean value which indicates if the toolbar will be displayed or an Object with `items`. |
| 100 | + |
| 101 | +### toolbar.items `Array` |
| 102 | + |
| 103 | +The following list indicates the default tools: |
| 104 | + |
| 105 | +* `pager` |
| 106 | +* `open` |
| 107 | +* `download` |
| 108 | + |
| 109 | +#### Example - customizing the toolbar items |
| 110 | + |
| 111 | + <div id="pdf-viewer"></div> |
| 112 | + <script> |
| 113 | + $("#pdfviewer").kendoPdfViewer({ |
| 114 | + toolbar: { |
| 115 | + items: [ |
| 116 | + "pager", "spacer", "open", "download", "exportAs" |
| 117 | + ] |
| 118 | + } |
| 119 | + }); |
| 120 | + </script> |
| 121 | + |
| 122 | +### toolbar.items.type `String` |
| 123 | + |
| 124 | +### toolbar.items.overflow `String` |
| 125 | + |
| 126 | +### toolbar.items.command `String` |
| 127 | + |
| 128 | +### toolbar.items.click `Function` |
| 129 | + |
| 130 | +### messages `Object` |
| 131 | + |
| 132 | +Specifies the localization messages of the PDFViewer. |
| 133 | + |
| 134 | +### messages.defaultFileName `String` *(default: "Document")* |
| 135 | + |
| 136 | +Specifies the default file name used for `Download`. |
| 137 | + |
| 138 | +### messages.toolbar `Object` |
| 139 | +Specifies the localization messages of the toolbar. |
| 140 | + |
| 141 | +### messages.toolbar.open `String` *(default: "Open")* |
| 142 | +### messages.toolbar.exportAs `String` *(default: "Export")* |
| 143 | +### messages.toolbar.download `String` *(default: "Download")* |
| 144 | +### messages.toolbar.pager `Object` |
| 145 | +### messages.toolbar.pager.first `String` *(default: "Go to the first page")* |
| 146 | +### messages.toolbar.pager.previous `String` *(default: "Go to the previous page")* |
| 147 | +### messages.toolbar.pager.next `String` *(default: "Go to the next page")* |
| 148 | +### messages.toolbar.pager.last `String` *(default: "Go to the last page")* |
| 149 | +### messages.toolbar.pager.of `String` *(default: " of {0} ")* |
| 150 | +### messages.toolbar.pager.page `String` *(default: "page")* |
| 151 | +### messages.toolbar.pager.pages `String` *(default: "pages")* |
| 152 | +### messages.errorMessages `Object` |
| 153 | +### messages.errorMessages.notSupported `String` *(default: "pages")* |
| 154 | +### messages.errorMessages.parseError `String` *(default: "pages")* |
| 155 | +### messages.dialogs `Object` |
| 156 | +### messages.dialogs.exportAsDialog `Object` |
| 157 | +### messages.dialogs.exportAsDialog.title `String` *(default: "pages")* |
| 158 | +### messages.dialogs.exportAsDialog.defaultFileName `String` *(default: "pages")* |
| 159 | +### messages.dialogs.exportAsDialog.pdf `String` *(default: "Portable Document Format (.pdf)")* |
| 160 | +### messages.dialogs.exportAsDialog.png `String` *(default: "Portable Network Graphics (.png)")* |
| 161 | +### messages.dialogs.exportAsDialog.svg `String` *(default: "Scalable Vector Graphics (.svg)")* |
| 162 | +### messages.dialogs.exportAsDialog.labels `Object` |
| 163 | +### messages.dialogs.exportAsDialog.labels.fileName `String` *(default: "File name")* |
| 164 | +### messages.dialogs.exportAsDialog.labels.saveAsType `String` *(default: "Save as")* |
| 165 | +### messages.dialogs.exportAsDialog.labels.page `String` *(default: "Page")* |
| 166 | +### messages.dialogs.okText `String` *(default: "OK")* |
| 167 | +### messages.dialogs.save `String` *(default: "Save")* |
| 168 | +### messages.dialogs.cancel `String` *(default: "Cancel")* |
| 169 | + |
| 170 | +## Methods |
| 171 | + |
| 172 | +### fromFile |
| 173 | + |
| 174 | +### activatePage |
| 175 | + |
| 176 | +### setOptions |
| 177 | + |
| 178 | +### destroy |
| 179 | + |
| 180 | +## Events |
| 181 | + |
| 182 | +### render |
| 183 | + |
| 184 | +### open |
| 185 | + |
| 186 | +### error |
0 commit comments