2X faster development
The ultimate ASP.NET Web Forms UI toolkit to boost your development speed.
This article explains how to customize the default toolbar of PDF viewer in ASP.NET. Customization is the process of designing your own toolbar using the exposed public APIs in PDF viewer.
The following code example illustrates how to create custom toolbar for the PDF viewer with the given items:
HTML //creating custom toolbar <div id="toolbarDiv" style="height:38px;width:100%;border:solid black 1px" class="toolbarclass " role="toolbar"> <div style="float:left; padding:5px;"> <div class="e-pdfviewer-icon e-pdfviewer-gotoprevious" id="viewer-previous" onclick="callClientSideMethod('previous')"></div> <div class="e-pdfviewer-icon e-pdfviewer-gotonext" id="viewer-next" onclick="callClientSideMethod('next')"></div> <div class="e-pdfviewer-icon e-pdfviewer-zoomin" id="viewer-zoomin" onclick="callClientSideMethod('zoomin')"></div> <div class="e-pdfviewer-icon e-pdfviewer-zoomout"id="viewer-zoomout" onclick="callClientSideMethod('zoomout')"></div> <div class="e-pdfviewer-icon e-pdfviewer-fitwidth" id="viewer-fitwidth" onclick="callClientSideMethod('fitwidth')"></div> <div class="e-pdfviewer-icon e-pdfviewer-fitpage" id="viewer-fitpage" onclick="callClientSideMethod('fitpage')"></div> </div> <div style="float:right; padding:5px;"> <div class="e-pdfviewer-icon e-pdfviewer-print" id="viewer-print" onclick="callClientSideMethod('print')"></div> <div class="e-pdfviewer-icon e-pdfviewer-download" id="viewer-download" onclick="callClientSideMethod('download')"></div> </div> </div>
Note: Syncfusion PDF viewer toolbar icons are used for customization in the previous code, your own icons can be used for custom toolbar. JS $(function () { var pdfviewer = $("#PdfViewer1").data("ejPdfViewer"); //hide the default toolbar of the PDF Viewer pdfviewer.showToolbar(false); }); function callClientSideMethod(apiName) { var _ejPdfViewer = $("#PdfViewer1").data("ejPdfViewer"); //call the client-side events switch (apiName) { case 'print': _ejPdfViewer.print(); break; case 'zoomin': _ejPdfViewer.zoomIn(); break; case 'zoomout': _ejPdfViewer.zoomOut(); break; case 'fitpage': _ejPdfViewer.fitToPage(); break; case 'fitwidth': _ejPdfViewer.fitToWidth(); break; case 'previous': _ejPdfViewer.goToPreviousPage(); break; case 'next': _ejPdfViewer.goToNextPage(); break; case 'download': _ejPdfViewer.download(); break; } } Sample: http://www.syncfusion.com/downloads/support/directtrac/general/ze/PdfViewerWeb-1747609725 |
2X faster development
The ultimate ASP.NET Web Forms UI toolkit to boost your development speed.
This page will automatically be redirected to the sign-in page in 10 seconds.