I have a kiosk screen that dynamically updates the src for an iframe when clicking different options. I am trying to create a print function that would print the content that is within the iframe. The iframe consists of locally hosted PDFs, website hosted PDFs and outside html pages. I have looked up and tried several options to no avail. My current setup has a contiainer div that contains an iframe and the print icon. The goal would be to have the print icon clicked which would open the print preview showing only the content in the iframe itself. Here is one of the options I have used so far:
-
function printFrame(docframe) { var frm = document.getElementById(docframe).contentWindow; frm.focus();// focus on contentWindow is needed on some ie versions frm.print(); return false; }
I am getting nothing from this. I have tried other options but all see to fall flat.
I am currently trying to get this to work in Chrome. Because it is a kiosk I am not
concerned with getting this to work on multiple browsers for now. Any help, direction
or guidance would be greatly appreciated!