1

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 javascript in the document.

Is there some way using javascript or Struts that I can tell the page to print?

Thanks!

user2662692
  • 227
  • 5
  • 15
  • 1
    http://stackoverflow.com/questions/8733276/how-to-open-print-dialog-after-pdf-generated – Dave Newton Aug 08 '13 at 00:58
  • Thanks! I will give this a try when I get home. However I have already tried embedding javascript in the pdf, but when viewing it in safari, it doesn't seem to run. It works fine in Chrome, or in Safari if you have an adobe plugin to view the pdfs, but not when viewing them in safari w/o plugins. – user2662692 Aug 08 '13 at 01:38

0 Answers0