• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

open pdf file in jsp

 
lokesh jain
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
lokesh jain
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic