Hi,
I have been able to create a PDF using iText libraries.
Now what I want is that this PDF should automatically open in IE instead of getting crated on one of the drives of the computer (version 6.0) as soon as it is created without any human involvement.
Please provide pointers or code snippet.
Thanks,
Himanshu
Shinelin Samuel
Ranch Hand
Joined: Mar 01, 2010
Posts: 55
posted
0
HI,
You can load it using JavaScript with document.URL = <PDF path> or redirect the Servlet request to the PDF path.
Himanshu Naini
Greenhorn
Joined: Mar 01, 2010
Posts: 4
posted
0
Hi Samuel,
My problem is that I cannot invole servlets from the application I am working on.
Do you have any other ideas?
Regards,
Himanshu
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35249
7
posted
0
The web app has no control over what happens to a downloaded on the client - that's entirely up to the browser and how the user has configured it. It may be saved automatically, it may get displayed automatically, or the user may be asked what to do with it each time.
Hi Ulf,
I have my pdf data in a byte array made out of ByteArrayOutputStream that I created using iText.
What I want to know is how to push this byte array into an internet explorer page.
Please help.
Regards,
Himanshu
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35249
7
posted
0
See the SimpleStream example in http://faq.javaranch.com/java/CodeBarnServlets for how to stream binary data to a client. As I said, there's no guarantee that the client will display the PDF in a browser window (or any window, actually).
Himanshu Naini
Greenhorn
Joined: Mar 01, 2010
Posts: 4
posted
0
Hi Ulf,
Thanks for the prompt reply.
However I have another problem. I cannot invoke JSPs/Servlets from my application as it does not support .
So is there any other way of streaming other than JSPs or servlets.
Regards,
Himanshu
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35249
7
posted
0
Well, then what kind of application is this? You mentioned IE, so it was natural to assume a web app.