Not sure if it is the right forum because it involves different pieces of technology, but still here I go...
I have a button (Print ) on my web page, which if clicked, calls a
servlet, which in turn does some server stuff and generated a byte array representing PDF data. The byte array is properly generated and no problem what so ever and I am able to send the data back to the browser.
I want to somehow open that data in adobe along with a print dialog (for that byte array), which MUST appear on client side and not on the server.
I tried
java print API and as expected it opens up the print dialog on the server and not on the browser. I also tried some client side specific stuff, details are as follows -
First, I tried using a static pdf which is there on the file system, and teh problem with this is that with some adobe versions or IE version the "printWithDialog" does not seem to work. I get a java script error saying that the function is not available.I am not sure whether there is really an issue with adobe version or IE version, but I have experienced it.
So, on click of the button, I am not calling servlet directly, rather calling this HTML, so that pdf opens up with a print dialog.
In the real scenario, I would put my servlet's path in the
data attribute of
object tag. My questions are -
1. Am I right when I say that printWithDialog function is not reliable ?
2. Is there a way to somehow send some response headers or something so that browser reads it and open up a print dialog (that way printWithDialog won't be used).
3. is it possible to use print API and still be able to invoke the print dialog on client side (insane question, I know).
4. java Web Start - does it come into picture, in this case ?