I have a JSF / Seam web application in which there is a page with a form, which when submitted (clicking a button) leads to the dynamic creation of a PDF file (in Java, on the server side) based on the form input. Currently, I work in that the resulting PDF file is returned to the browser as a file download, so the user can choose to save it or open it in Acrobat Reader for later printing. A.
What I would like to do is that the PDF code is sent to the browser and printed (on the client side) without additional user intervention (well, except for the Windows printer settings dialog box, about which I can do nothing).
The solution is similar to having a hidden iframe on the page into which the PDF file is loaded, and then calling .contentWindow.print() on the iframe . However, I do not know how to get a PDF file in an iframe via HttpServletResponse (in Java), and even more so how to automatically call print () on an iframe after loading pdf.
source share