fromFile

Displays the file passed as a parameter in the PDFViewer. Currently, supported only for PDFJS Processing.

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">
            <div class="box-col">
                <h4>Load File</h4>
                <ul class="options">
                    <li>
                        <button class="k-button" id="loadFile" type="button">Load</button>
                    </li>
                </ul>
            </div>
        </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");

            $("#loadFile").click(function () {
                pdfViewer.fromFile("https://demos.telerik.com/kendo-ui/content/web/pdfViewer/How Does Kendo UI Cut Development Time.pdf")
            });
        });
    </script>
In this article
Not finding the help you need? Improve this article