Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Display PDF contain on JSP page

  Asked By: Bill    Date: Apr 23    Category: Java    Views: 2631
  

I need to display the content of a PDF file and also an excel file on my jsp
page. Both of these files contain images and diagrams that must be displayed on
the page.
I searched on the Internet but I haven't got proper answer.
Do you know how should I display these diagrams on the page?

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Barak Levi     Answered On: Apr 23

You cannot do this in a JSP for exactly the reasons Paul mentioned. JSPs are solely inteneded to render character response data. Anything else, be it PDF, images  or any other binary stream, must be emitted with a servlet.

create servlet file.
for example
setContentType(application/excel); but I think it depends on your browser.

also for pdf  file setContentType(application/pdf);

open your pdf or excel file  and read its content.

 
Answer #2    Answered By: Rosalie Holmes     Answered On: Apr 23

You can't show it like that, You can use a library like pdfbox from apache or
pdfrenderer from sun to extract contents from pdf  files. There is also better
ways to do it if you just want to export each page  as an image.

 
Didn't find what you were looking for? Find more on Display PDF contain on JSP page Or get search suggestion and latest updates.




Tagged: