This commit is contained in:
@@ -632,46 +632,6 @@ export default {
|
|||||||
handleError("uploadLogo", error, route);
|
handleError("uploadLogo", error, route);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//this worked on all platforms except phone browser
|
|
||||||
//safest way is to just trigger a window open to download the pdf which is what I did
|
|
||||||
//Keeping this in a commit in case I need to revisit it later
|
|
||||||
// ,
|
|
||||||
// viewPDF(blobData, reportName) {
|
|
||||||
// // https://gist.github.com/bondgeek/d44657b2a65e45cb3a645454845fe500
|
|
||||||
|
|
||||||
// //possibly useful links:
|
|
||||||
// //https://blog.jayway.com/2017/07/13/open-pdf-downloaded-api-javascript/
|
|
||||||
// //https://gist.github.com/devloco/5f779216c988438777b76e7db113d05c
|
|
||||||
// //https://github.com/eligrey/FileSaver.js
|
|
||||||
// const fileName = (reportName && `${reportName}.pdf`) || "myreport.pdf";
|
|
||||||
// const newBlob = new Blob([blobData], { type: "application/pdf" });
|
|
||||||
// const newWindow = window.open("", reportName, "width=800,height=1200");
|
|
||||||
// if (newWindow != null) {
|
|
||||||
// setTimeout(() => {
|
|
||||||
// const dataUrl = window.URL.createObjectURL(newBlob);
|
|
||||||
// const title = newWindow.document.createElement("title");
|
|
||||||
// const iframe = newWindow.document.createElement("iframe");
|
|
||||||
|
|
||||||
// title.appendChild(document.createTextNode(reportName));
|
|
||||||
// newWindow.document.head.appendChild(title);
|
|
||||||
|
|
||||||
// iframe.setAttribute("src", dataUrl);
|
|
||||||
// iframe.setAttribute("width", "100%");
|
|
||||||
// iframe.setAttribute("height", "100%");
|
|
||||||
|
|
||||||
// newWindow.document.body.appendChild(iframe);
|
|
||||||
|
|
||||||
// setTimeout(() => {
|
|
||||||
// // For Firefox it is necessary to delay revoking the ObjectURL
|
|
||||||
// window.URL.revokeObjectURL(dataUrl);
|
|
||||||
// }, 100);
|
|
||||||
// }, 100);
|
|
||||||
// } else {
|
|
||||||
// alert(
|
|
||||||
// "To display reports, please disable any pop-blockers for this page and try again."
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//---------------
|
//---------------
|
||||||
|
|
||||||
//new functions above here
|
//new functions above here
|
||||||
|
|||||||
@@ -703,7 +703,11 @@ Handlebars.registerHelper('loud', function (aString) {
|
|||||||
name: "Demko"
|
name: "Demko"
|
||||||
});
|
});
|
||||||
|
|
||||||
window.$gz.api.viewPDF(pdf, "myreport");
|
let reportUrl = indow.$gz.api.reportDownloadUrl(pdf.data);
|
||||||
|
if (window.open(reportUrl, "_blank") == null) {
|
||||||
|
//window open failed, maybe popup blocker
|
||||||
|
//show error to user
|
||||||
|
}
|
||||||
//
|
//
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user