У меня есть этот код, я пытаюсь загрузить BLOB-файл PDF, где бы он ни был успешно открыт в новой вкладке, но я хочу, чтобы этот PDF-файл загружался в Syncfusion ejpdfviewer, любые предложения
html <div id="iframe"></div>
JavaScript
xhr.open('POST', '/MifosX/Reports/RunReportPDF');
xhr.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');
xhr.send(JSON.stringify(reportrequestviewmodel));
xhr.responseType = "blob";
xhr.onreadystatechange = function () {
let stateCode = 0;
console.log("readyState", this.readyState);
console.log("status", this.status);
if (this.readyState === 4) {
this.onreadystatechange = null;
if (this.status === 200) {
var file = new Blob([xhr.response], { type: 'application/pdf' });
var fileURL = URL.createObjectURL(file);
window.open(fileURL);
console.log(fileURL);
$("#iframe").ejPdfViewer({ serviceUrl: fileURL, interactionMode: 1 });
console.log(xhr.response);
} else {
alert(this.statusText);
stateCode = -1;
}
}
return stateCode;```