destroy

Destroys the widget.

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">
        <div class="box">
                <ul class="options">
                    <li>
                        <button class="k-button" id="destroyBtn" type="button">Destroy the widget</button>
                    </li>
                </ul>
        </div>
        <div id="pdfViewer">
        </div>
    </div>

    <script>
        $(document).ready(function () {

            var pdfViewer = $("#pdfViewer").kendoPDFViewer({
                pdfjsProcessing: {
                    file: "https://demos.telerik.com/kendo-ui/content/web/pdfViewer/sample.pdf"
                },
                width: "100%",
                height: 700
            }).data("kendoPDFViewer");

            $("#destroyBtn").click(function () {
              console.log('--- Before Destroy ---')
              console.log($("#pdfViewer").data("kendoPDFViewer"))
              $("#pdfViewer").data("kendoPDFViewer").destroy();
              console.log('--- After Destroy ---')
              console.log($("#pdfViewer").data("kendoPDFViewer"))

              // The destroy() method will destroy the PDFViewer widget. To remove the rendered component remove or empty the element from      which the widget has been initialized
              //$("#pdfViewer").remove()
            });
        });
    </script>
In this article