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/2.2.2/pdf.js"></script>
    <script>
        window.pdfjsLib.GlobalWorkerOptions.workerSrc = 'https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.2.2/pdf.worker.js';
    </script>

    <div id="example">

        <input type="button" value="Download" onclick="onDownloadClick()"/>
        <div id="pdfViewer">
        </div>
    </div>

    <script>



        $(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>
In this article
Not finding the help you need? Improve this article