• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Can a web application open a pdf file that exists on the client side

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I'm not a java developer, but I found an aswer in this forum similar to what I am trying to do in ASP and PHP. The link is https://coderanch.com/t/328414/java/java/open-local-file-Java-program .

Here is what I want to do: I have an ASP site (and an equivalent in PHP) and based on an id that the user enters in an ASP page, I calculate a path, e.g c:\myFolfer\file1.pdf. This path refers to the client's computer, and I need to open a popup and show the user the pdf that he already has stored on his pc. These pdf files are not stored at the server and I cannot change the application so that they are uploaded to the server. I just need to show a file that is stored at the client.

I read the post mentioned before, where it says "So it's a Web application, and the PDF file is already on the desktop machine. This is not the kind of scenario that Web technologies are built to deal with, unfortunately. The only way that occurs to me to do this is to have a signed Java applet on the web page; that signed applet can ask for and be granted (by the user) permission to launch an application with that file. It's a lot of work, it's messy, and users won't like granting the permission."

So, my question is: Is a signed applet the only way to do this? If so, could you give me some directions where to start? Or could I find something free in the web?

Many thanks
Martha
 
Ranch Hand
Posts: 530
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, a signed Java applet has permission to read local resources on user's computer, including PDF files.
There are some free (LGPL) versions of PDF reader programs on the web such as JPedal which you can use in your applet.
 
Ranch Hand
Posts: 123
Firefox Browser Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How about generating an html link (e.g. and anchor html tag) pointing to the file in the harddisk, and inform the user to click it? It may trigger the default client pc's pdf reader to open it.
 
Bartender
Posts: 2661
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What happens if you generate a block of code like the one below, replacing the path to the pdf with the location on the local pc?



Note: replace the {} with <>. i did this because my code doesn't appear correctly in this post.
 
reply
    Bookmark Topic Watch Topic
  • New Topic