Hi,
currently i found an workaround for the request but a native support would by cool. Token in url is no alternative
Workaround:
axios({
url: `${config.apiUrl}/Page/pdf/` + id,
method: 'GET',
responseType: 'blob',
headers : {
"Authorization": authHeader().Authorization
}
}).then((response) =>{
var fileReader = new FileReader();
fileReader.readAsDataURL(response.data);
fileReader.onload = function(e){
var pdfViewer = $("#documentViewer").data("kendoPDFViewer");
if(!pdfViewer){
pdfViewer = $("#documentViewer").kendoPDFViewer({
pdfjsProcessing: {
file: {
data: e.target.result.split(",")[1]
}
},
width: "100%",
}).data("kendoPDFViewer");
}else{
console.log("fromFile function");
// pdfViewer.fromFile(`${config.apiUrl}/Page/pdf/` + id);
pdfViewer.zoomScale = pdfViewer.options.scale || 1.25;
pdfViewer.trigger("update", { action: "zoom", zoom: pdfViewer.options.scale || "auto" });
pdfViewer.options.pdfjsProcessing.file.data = e.target.result.split(",")[1];
pdfViewer._loadDocument();
}
}
})
Added by admin:
The request is a valid one but it should be extended outside the context of Axios. It will be a good feature to introduce a general approach for fetching a file dynamically - jQuery, Axios, etc.