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

open pdf file in jsp

lokesh jain
Ranch Hand

Joined: Feb 21, 2009
Posts: 58
Hi, i have made a jsp in which i made a button "view" and i have a pdf on my local machine. Ii want to open pdf file on click of view button. I used onclick property and tried in javascript window.open("test.pdf") but it is not opening my pdf. please help

Thanks in advance
Lokesh
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42289
    
  64
Web applications have no access to local files. If the user wants to open a PDF, can't he just double-click it in his file explorer?


Ping & DNS - my free Android networking tools app
lokesh jain
Ranch Hand

Joined: Feb 21, 2009
Posts: 58
Thanks for that ulf, however in my application, when i click on make, it makes a pdf file in client's D: drice...but on click of view..my client wants to view that file. So how to achieve this thing? Can you Suggest?

Thanks in advance
Lokesh
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42289
    
  64
A web app can't create a file on the client's machine. It can stream PDF data that the browser decides to save on the client machine, IF the user at some point instructed the browser to save all PDFs automatically. Otherwise, the browser will open a little dialog, asking the user whether to open the file with some application, or to save it.
 
wood burning stoves
 
subject: open pdf file in jsp