I have the following PDF Viewer in my view, How can I update pdf.File(Url.Content("~/pdf/test.pdf")
based on the selected project.
JavaScript
x
16
16
1
<div id="preview">
2
3
@(Html.Kendo().PDFViewer().Name("pdfPreview")
4
.PdfjsProcessing(pdf => pdf.File(Url.Content("~/pdf/test.pdf")))
5
.Toolbar(toolbar =>
6
toolbar.Items(items =>
7
{
8
items.Add().Name("pager");
9
})
10
)
11
.Height(701)
12
)
13
</div>
14
15
16
Advertisement
Answer
You can load the pdf like so – I can’t test this right now, so there may be some typo’s but this is based on the example located here: https://demos.telerik.com/aspnet-mvc/pdfviewer/api
JavaScript
1
10
10
1
$.ajax({
2
url: `/product/product/pdfDocumentread?documentID=${documentID}&productID=${productID}`,
3
type: 'GET'
4
})
5
.done(function(data) {
6
//here I want to load data.DocumentFilePath to PDF preview
7
var pdfViewer = $("#pdfPreview").data("kendoPDFViewer");
8
pdfViewer.fromFile(data.DocumentFilePath)
9
})
10