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

Can we open local PDF files on jsp onclicking URL in jsp

Harshal Gurav
Ranch Hand

Joined: May 29, 2008
Posts: 151
Hi All,

I am running web application on server machine.
In web application, i am creating pdf file using itext and saving it on folder c:/PdfFilepath/

I am trying to open this PDF from my web application like : http://localhost:8080/Reportgenarate/showCert.jsp

i am accessing in following fashion:
String path="file:///C:/PdfFilepath/nargi.pdf";



also try with following fashion



When i try to open it from ablove like in firefox, it shows an error like :
firefox doesn't know how to open this address because the protocol


I also installed LocalLink 0.5 add on for firefox. it doesnot work

I am awaire that commons-fileupload-1.2.2 jar is best option to upload file on the server and access it

My application require it should access from c:/PdfFilepath/nargi.pdf

any suggestion is highly appreciate


Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61437
    
  67

Of course not. The file protocol looks for the file on the local file system. So your users would need to already have that file on their own systems. That doesn't make any sense, does it?

If you want to serve the file you'll either need to place it within the web application so that it can be addressed via URL, or write a servlet that will read the file and stream it as the response, setting the appropriate headers.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
wood burning stoves
 
subject: Can we open local PDF files on jsp onclicking URL in jsp