• Post Reply Bookmark Topic Watch Topic
  • New Topic

opening PDF file from jsp page

 
AnilPrakash Raju
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

How can i open a pdf file from my jsp page. from the back-end i am getting a string containing the location of the pdf file.

thanks in advance.

Anil
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the file is reachable from from a browser, you can just link to it.
Otherwise, you'll need to stream it from a servlet.

I have an example app that streams binary files from the server (in this case images but PDFs would be no different).
Simple Servlet Examples.
Look for SimpleStream.
 
AnilPrakash Raju
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ben, but i could not figure it out from the SimpleStream example.

Anil
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's got you stumped? Were you able to run the example?
 
AnilPrakash Raju
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think so.

When i run it, i see the following text: The following image files are located under the WEB-INF directory and, thus, can not be seen with a browser unless streamed through the StreamServlet:

The first of the image links takes me to you website.

but i can't see how it works.
I am using JBuilder, and i can only see the index.html

Thanks

Anil
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!