aspose file tools*
The moose likes Struts and the fly likes PDF display in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "PDF display in JSP" Watch "PDF display in JSP" New topic
Author

PDF display in JSP

Nivan scorp
Greenhorn

Joined: Dec 06, 2004
Posts: 23
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

Joined: Feb 23, 2005
Posts: 221
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.
 
 
subject: PDF display in JSP