my dog learned polymorphism*
The moose likes JSP and the fly likes storing .pdf files in jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "storing .pdf files in jsp" Watch "storing .pdf files in jsp" New topic
Author

storing .pdf files in jsp

Santosh Kumar
Ranch Hand

Joined: May 25, 2005
Posts: 30
hi

can anyone please tell me which is the best way to store the .pdf files..is it in oracle or in files...how can i open a pdf file using jsp...

plsease reply as soon as possible
[ May 29, 2005: Message edited by: Santosh Kumar ]
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1081

It actually depends on you requirement and feasibility, though you can use LOB or BLOB to store files in database, but for me storing file in datbase would be last option to do.

I would rather prefer to store their path in datbase and will place them in file system
placing file in database makes datbase heavy and requires more table spaces for databases, consequntly every backup of DB also becomes heavy, even for viewing a file needs coding.

if you do not have to many files then you can go for it otherwise you will have to plan it carefully.


Shailesh
[ May 29, 2005: Message edited by: Shailesh Chandra ]

Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
how can i open a pdf file using jsp...


Make a link to that pdf.
[ May 30, 2005: Message edited by: Adeel Ansari ]
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12803
    
    5
If you want to serve a PDF file directly instead of providing a link, use a servlet. JSP are designed to serve character data, PDF should be served as binary data - same goes for images. There have been MANY discussions related to this in this forum.
Bill
Senthil B Kumar
Ranch Hand

Joined: Feb 09, 2004
Posts: 140
If u want this in simple terms,

Read the PDF in binary mode and write the contents back to the out stream which is sent to the browser, and the pdf file if associated with a reader or if the browser has the plugin installed, it will open up.


Work like you don't need the money. Love like you've never been hated. Dance like nobody's watching. Sing like nobody's listening. Live like it's Heaven on Earth.
Currently I Reside Here WEBlog
Raj Puri
Ranch Hand

Joined: Apr 24, 2003
Posts: 189
Consider storing as Oracletext data type. You can store pdf, xls, word etc. Good thng is that 9i has sql that let you search these files and show resultd hightlighted etc like Google. I did a while back these things and now I am learning hard Java way to do the same thing.
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Originally posted by Senthil B Kumar:
If u want this in simple terms,

Read the PDF in binary mode and write the contents back to the out stream which is sent to the browser, and the pdf file if associated with a reader or if the browser has the plugin installed, it will open up.


Not getting you. Could you please try to be more simple.

What I got is something irrational. You dont want to send the pdf, but you want to read the pdf and send the contents. Moreover you want the browser would open up a pdf to show those contents.

If thats all you want then, i would ask, Why?

Just to inform you a pdf file is more like an image file. Its not that simple to read the pdf. Have got the library to read the pdf file or you are making your own? If you have got some library then please share.

thanks.
Senthil B Kumar
Ranch Hand

Joined: Feb 09, 2004
Posts: 140
Reading a PDF for this purpouse doesnt needs any special library, because we are going to read it using java's binary I/O methods and write the contents back without anychange or parsing
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Originally posted by Senthil B Kumar:
Reading a PDF for this purpouse doesnt needs any special library, because we are going to read it using java's binary I/O methods and write the contents back without anychange or parsing


Well, then just get the binary and send it to the browser.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: storing .pdf files in jsp