Hello.
APEX v21.1.4 (will be upgrading to latest soon).
Apologies in advance for the long post - I wanted to get my problem and why I am doing it this way across.
I have a static region whereby I display a PDF file stored in a db BLOB column with the following code.
<div id="pdfViewer" style="width: 100%; height: 500px">
<iframe src="&P5_URI_TO_PDF.#toolbar=1" style="border:2px solid grey;" type="application/pdf"
width="100%" height="100%">
</iframe>
</div>
This works fine. I switch the PDF Toolbar menu off as due to the nature of the data displayed (Client Clinical Data) I want to control the ‘Download’, ‘Email’ and ‘Print’ via APEX Buttons which are displayed only if the logged in user has the appropiate security role.
When trying to Print via the button, the print seems to get truncated (first page chopped off and second page missing). The code I use to print is the following javascript on a DA on the print button is
var divToPrint=document.getElementById('pdfViewer');
var newWin=window.open('','Print-Window');
newWin.document.open();
newWin.document.write('<html><body onload="window.print()">'+divToPrint.innerHTML+'</body></html>');
newWin.document.close();
setTimeout(function(){newWin.close();},10);
If I place my mouse in the PDF Viewer and right-mouse-click and print I see the full PDF document in the preview. However, right-mouse-click will be disabled outside of Development environments.
Q. Does anyone know what could be going wrong (admittly javascript is something I am learning as I go along)?
Q. Is there any way to obtain the PDF (using ORDS) and send it to a printer on the client machine?
Q. Any alternative ways I could achieve my end goal?
Thanks in advance,
Sunny Patel.