Wednesday, 7 August 2013

Struts 2 stream result. Run javascript on page

Struts 2 stream result. Run javascript on page

I have dynamically created a PDF using the PDFBox library. Then, I use the
Struts 2 stream result to display the pdf in the browser like this:
<result name="preview" type="stream">
<param name="contentType">application/pdf</param>
<param name="inputName">inputStream</param>
<param name="contentDisposition">filename="stream.pdf"</param>
<param name="bufferSize">1024</param>
</result>
What I want to do now, is to have the browser open the print dialogue. I
tried embedding javascript in the pdf with Adobe Acrobat Pro, and this
works as long as the user has an Adobe pdf viewer plugin in their browser.
However, I am trying to make this work with Safari, and it seems that the
default in browser pdf viewer over rides the embedded pdf in the document.
Is there some way using javascript or Struts that I can tell the page to
print?
Thanks!

No comments:

Post a Comment