• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Open iText generated pdf in Internet explorer

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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



 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
What could go wrong in a swell place like "The Evil Eye"? Or with this tiny ad?
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic