execute
Executes a command of the PDFViewer.
To run the below example, open it in Dojo
Example
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/4.3.136/pdf.mjs" type="module"></script> <!-- Include pdf.js before the kendo scripts -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/4.3.136/pdf.worker.mjs" type="module"></script> <!-- Include pdf.worker.js before the kendo scripts -->
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2024.4.1112/js/kendo.all.min.js" type="module"></script>
<div id="example">
<input type="button" value="Download" onclick="onDownloadClick()"/>
<div id="pdfViewer">
</div>
</div>
<script type="module">
$(document).ready(function () {
$("#pdfViewer").kendoPDFViewer({
pdfjsProcessing: {
file: "https://demos.telerik.com/kendo-ui/content/web/pdfViewer/sample.pdf"
},
width: "100%",
height: 1000,
toolbar: {
items: [
"pager",
"spacer",
"open",
"download"
]
}
});
});
function onDownloadClick(){
var pdfViewer = $("#pdfViewer").data("kendoPDFViewer");
pdfViewer.execute({command:"DownloadCommand"});
}
</script>