Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>As I said in my question we already generate the PDF data on the server.</p> <p>We need to have the byte data available on the client side to be passed via a JS call to a Java applet. We do this currently via a hidden field. That's okay and it works just fine.</p> <p>The problem is that the call to the applet only takes place if the okay button on an ajax modal dilaog is clicked ('Do you want to send this document to UglyProprietorySystem?').</p> <p>As you all know you can't put anything on top of an adobe plug-in display. Obviously if the whole page is of type PDF then there's no place for any JS to show the dialog so <em>that</em> wouldn't work and if you use an IFrame you still can't put anything on top of what the plug-in displays (it's effectively another app's airspace and violating that is just plain rude!).</p> <p>We worked around this by: </p> <ol> <li>Inititally showing a blurred image of a generic PDF doc and popping the modal dialog on top of that.</li> <li>When the user had responded to the dialog we called (or not) the java app with the pdf byte data from the hiden field</li> <li>We then posted back after clearing the hidden field (Woo! Posting back a form with PDF binary data is <em>not</em> appreciated by the server!)</li> <li>In the page_load of the code behind we then, on postback, wrote to the response stream with he PDF byte data, setting the contentype to be appplication/pdf and thus the pdf is displayed.</li> </ol> <p>Lovely. It all works and gets us <em>kind</em> of what we'd like.</p> <p>Only problem is we either need to: </p> <ul> <li>generate the PDF data twice (once on initital page_load for the clientside call to our applet and then again on postback to display).</li> </ul> <p>or</p> <ul> <li>We store the PDF byte data in the session after the first response so as to be able to, after the postback, still have the pdf data to be able to display it.</li> </ul> <p>Neither is great but we went with the latter but now we're thinking we'd like to avoid that if we can.</p> <p>Thus the idea of generating the PDF, putting it into a hidden field, having a button on the page to save the PDF to our proprietary system via an applet call and also writing to the IFrame with that data already on the client in the hidden field thus displaying it.</p> <p>Phew!</p> <p>So that's why we wanted to <em>on the client</em> using JS, write the pdf binary data to the IFrame and have it's content type set to application/pdf so the browser would load up the adobe plug-in and display it.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload