• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Open iText generated pdf in Internet explorer

 
Himanshu Naini
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,
You can load it using JavaScript with document.URL = <PDF path> or redirect the Servlet request to the PDF path.
 
Himanshu Naini
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Himanshu Naini
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, then what kind of application is this? You mentioned IE, so it was natural to assume a web app.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic