I am trying to convert over a jasperbean to display in the pdfJSViewer and I am a bit unsure about where to start. I was able to generate a pdf and output it to the downloads folder using this code:
However what I am trying to do is bring up my generated PDF in the pdfJSviewer like the example on the servoy demo site and allow the user to download the PDF if they are satisfied with the output rather than having them download the report and having to download again.
Hi
I’m not sure what the ‘runReport’ returns, but I wanted to display a PDF Invoice that I had generated & stored in a BLOB/Media field in my db using the pdfJSViewer, so using the example I made this
function loadDocument() {
if (invoice_image != null) {
// get invoice image
var remoteFileName = application.getUUID().toString() + '.pdf';
var remoteFile = plugins.file.convertToRemoteJSFile('/' + remoteFileName)
remoteFile.setBytes(invoice_image, true);
//Convert the remote file to a url, and display it in the PDF viewer
var remoteUrl = plugins.file.getUrlForRemoteFile('/' + remoteFileName);
if (remoteUrl) {
forms.frm_invoice_pdf.elements.pdf_Js_Viewer.documentURL = remoteUrl;
}
} else {
// no image
}
}
where ‘invoice_image’ is my media field (or byte array)