This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

PDF display in JSP

 
Nivan scorp
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I need to display a pdf document within an iframe in a JSP page.
The pdf is in the form of byte array.

Any clue on how this can be achieved?

Thanks,
Nivan.
 
Horatio Westock
Ranch Hand
Posts: 221
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could create a servlet to stream the blob data.

e.g. http://yoursite/fileservlet?id=5

Then have that as the source of your iframe. Basically the servlet implementation would simply query for the blob then direct the stream from the backend to the servlet output stream. If you search the web for "jsp image blob" or something similar, you should be able to find some sample code. Remember also to consider things like content-type and cache headers.

Alternatively I think there are probably some taglibs to help with this, but personally I prefer option 1.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic