File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Martha Liakopoulou
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • 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 http://www.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
 
Nam Ha Minh
Ranch Hand
Posts: 502
Eclipse IDE Firefox Browser Windows
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Kathleen Angeles
Ranch Hand
Posts: 123
Firefox Browser Spring Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Jan Cumps
Bartender
Posts: 2576
11
C++ Linux Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic