【问题标题】:How can load file to Kendo PDF Viewer?如何将文件加载到 Kendo PDF Viewer?
【发布时间】:2020-11-17 02:24:56
【问题描述】:

我的视图中有以下 PDF 查看器,如何根据所选项目更新 pdf.File(Url.Content("~/pdf/test.pdf")

 <div id="preview">
            
            @(Html.Kendo().PDFViewer().Name("pdfPreview")
                .PdfjsProcessing(pdf => pdf.File(Url.Content("~/pdf/test.pdf")))
                .Toolbar(toolbar =>
                        toolbar.Items(items =>
                        {
                            items.Add().Name("pager");                               
                        })
                    )
                    .Height(701)
                )
        </div>

   

【问题讨论】:

    标签: javascript jquery asp.net kendo-ui kendo-asp.net-mvc


    【解决方案1】:

    您可以像这样加载 pdf - 我现在无法对此进行测试,因此可能有一些错字,但这是基于此处的示例:https://demos.telerik.com/aspnet-mvc/pdfviewer/api

        $.ajax({
            url: `/product/product/pdfDocumentread?documentID=${documentID}&productID=${productID}`,
            type: 'GET'
        })
        .done(function(data) {
           //here I want to load data.DocumentFilePath to PDF preview
           var pdfViewer = $("#pdfPreview").data("kendoPDFViewer");
           pdfViewer.fromFile(data.DocumentFilePath)
        })
    

    【讨论】:

      猜你喜欢
      • 2020-05-26
      • 2016-10-08
      • 2020-01-06
      • 2018-08-14
      • 1970-01-01
      • 1970-01-01
      • 2020-04-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多