@@ -190,11 +190,17 @@ PDF Viewer allows you to customize(add, show, hide, enable, and disable) existin
190
190
{% tabs %}
191
191
{% highlight html tabtitle="Standalone" %}
192
192
193
+ @page "{handler?}"
194
+ @model IndexModel
195
+ @{
196
+ ViewData[ "Title"] = "Home page";
197
+ }
198
+
193
199
<div >
194
200
<ejs-pdfviewer id="pdfviewer"
195
201
style="width:1350px;height:100%"
196
202
documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
197
- resourceUrl='https://cdn.syncfusion.com/ej2/24 .1.41 /dist/ej2-pdfviewer-lib'
203
+ resourceUrl='https://cdn.syncfusion.com/ej2/29 .1.35 /dist/ej2-pdfviewer-lib'
198
204
toolbarClick="toolbarClick">
199
205
</ejs-pdfviewer>
200
206
</div >
@@ -256,68 +262,46 @@ PDF Viewer allows you to customize(add, show, hide, enable, and disable) existin
256
262
{% endhighlight %}
257
263
{% highlight html tabtitle="Server-Backed" %}
258
264
265
+ @page "{handler?}"
266
+ @model IndexModel
267
+ @using Syncfusion.EJ2.PdfViewer
268
+ @using Newtonsoft.Json
269
+ @{
270
+ ViewData[ "Title"] = "Home page";
271
+ CustomToolbarItems customToolbarItems = new CustomToolbarItems();
272
+ var toolItem1 = new { id = "submit_form", text = "Submit Form", tooltipText = "Custom toolbar item", align = "Center", cssClass = "custom_button" };
273
+ customToolbarItems.ToolbarItems = new List<object > { toolItem1, "OpenOption", "PageNavigationTool", "MagnificationTool", "PanTool", "SelectionTool", "SearchOption", "PrintOption", "DownloadOption", "UndoRedoTool", "AnnotationEditTool", "FormDesignerEditTool", "CommentTool" };
274
+ PdfViewerToolbarSettings toolbarSettings = new PdfViewerToolbarSettings()
275
+ {
276
+ ShowTooltip = true,
277
+ ToolbarItems = customToolbarItems.ToolbarItems
278
+ };
279
+ }
280
+
259
281
<div >
260
- <ejs-pdfviewer id="pdfviewer"
261
- style="width:1350px;height:100% "
262
- documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly .pdf"
263
- serviceUrl="/api/PdfViewer "
264
- toolbarClick="toolbarClick ">
282
+ <ejs-pdfviewer id="pdfviewer" style="height:600px"
283
+ serviceUrl="/Index "
284
+ documentPath="https://cdn.syncfusion.com/content/pdf/form-designer .pdf"
285
+ toolbarClick="toolbarClick "
286
+ ToolbarSettings="toolbarSettings ">
265
287
</ejs-pdfviewer>
266
288
</div >
267
289
268
- <script type =" text/javascript " >
269
- window .onload = function () {
270
- var pdfViewer = document .getElementById (' pdfviewer' ).ej2_instances [0 ];
271
- var toolItem1 = {
272
- prefixIcon: ' e-icons e-paste' ,
273
- id: ' print' ,
274
- tooltipText: ' Custom toolbar item' ,
275
- align: ' left'
276
- };
277
- var toolItem2 = {
278
- id: ' download' ,
279
- text: ' Save' ,
280
- tooltipText: ' Custom toolbar item' ,
281
- align: ' right'
282
- };
283
- var LanguageList = [' Typescript' , ' Javascript' , ' Angular' , ' C#' , ' C' , ' Python' ];
284
- var toolItem3 = {
285
- type: ' Input' ,
286
- tooltipText: ' Language List' ,
287
- cssClass: ' percentage' ,
288
- align: ' Left' ,
289
- id: ' dropdown' ,
290
- template: new ej.dropdowns.ComboBox ({ width: 100 , value: ' TypeScript' , dataSource: LanguageList, popupWidth: 85 , showClearButton: false , readonly: false })
291
- };
292
- var toolItem4 = {
293
- type: ' Input' ,
294
- tooltipText: ' Text' ,
295
- align: ' Right' ,
296
- cssClass: ' find' ,
297
- id: ' textbox' ,
298
- template: new ej.inputs.TextBox ({ width: 125 , placeholder: ' Type Here' , created: onCreate })
299
- };
300
- pdfViewer .toolbarSettings = {
301
- showTooltip: true ,
302
- toolbarItems: [toolItem1, toolItem2, ' OpenOption' , ' PageNavigationTool' , ' MagnificationTool' , toolItem3, ' PanTool' , ' SelectionTool' , ' SearchOption' , ' PrintOption' , ' DownloadOption' , ' UndoRedoTool' , ' AnnotationEditTool' , ' FormDesignerEditTool' , toolItem4, ' CommentTool' , ' SubmitForm' ]
303
- };
304
- function onCreate () {
305
- this .addIcon (' prepend' , ' e-icons e-search' );
306
- }
307
- }
308
-
309
- // Define the toolbarClick event handler
290
+ <script >
310
291
function toolbarClick (args ) {
311
- var pdfViewer = document .getElementById (' pdfviewer' ).ej2_instances [0 ];
292
+ var viewer = document .getElementById (' pdfviewer' ).ej2_instances [0 ];
293
+ if (args .item && args .item .id === ' submit_form' ) {
294
+ alert (' Custom button clicked!' );
295
+ }
296
+ }
297
+ </script >
312
298
313
- if (args .item && args .item .id === ' print' ) {
314
- pdfViewer .printModule .print ();
315
- } else if (args .item && args .item .id === ' download' ) {
316
- pdfViewer .download ();
317
- }
299
+ <style >
300
+ .custom_button {
301
+ height : 100% !important ;
318
302
}
303
+ </style >
319
304
320
- </script >
321
305
322
306
{% endhighlight %}
323
307
{% endtabs %}
0 commit comments