I am trying to use the PDFViewer to display a PDF downloaded from an Azure Blob.
In my view I have:
// Create a viewer if you do not have one already. var pdfViewer = $("#pdfViewer").data("kendoPDFViewer"); if (!pdfViewer) { pdfViewer = $("#pdfViewer").kendoPDFViewer({ pdfjsProcessing: { file: "" }, width: "100%", height: 500 }).data("kendoPDFViewer"); }; // Build the desired URL to point to your handler that will return the PDF. var pdfHandlerUrl = "/Home/getBlob/" + selectedRows.BlobID; // Make the PDFViewer load the designated file. pdfViewer.fromFile(pdfHandlerUrl);
An in my controller (getBlob) I have the following:
var stream = new MemoryStream(); await file.DownloadToAsync(stream); stream.Position = 0; return new FileStreamResult(stream, "application/pdf");
But in the view - I get a pop-up error message that says: PDF file fails to process.
Any suggestions?
Hi Eddie,
Could you please verify that the file is correct and it downloads successfully? You could do that by directly requesting the pdfHandlerUrl from the browser