File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Linux / UNIX and the fly likes How to open a PDF file in linux using java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "How to open a PDF file in linux using java" Watch "How to open a PDF file in linux using java" New topic

How to open a PDF file in linux using java

app nig

Joined: Feb 26, 2008
Posts: 3
How to open a PDF file in linux using java. i am able to do in mac and windows but didi not find any common solution for all the linux OS.

Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074

"appi", please check your e-mail for an important administrative message from JavaRanch.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Anil Karamchandan
Ranch Hand

Joined: Sep 12, 2009
Posts: 47
did any one find a solution to this, even I am facing with the same problem.. I have tried the rundell32 which is used by windows but I am not able to get the answer for Linux OS
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15959

I think this post was old enough to qualify for our "don't wake the zombies" rule, but now that it's up and lurching about, here goes.

I have no clue what rundll32 was supposed to do with opening PDF files.

There are number of utilities that can "open" (as in display) and read (as in processing the contents) PDF files. The most famous of which, of course, is the Linux edition of the Adobe Reader application, downloadable from their website. Some people think that the Adobe app is too fat, too insecure, or just prefer open source, however, so there are also a number of open-source PDF display apps as well. I commend you to Google for details.

Linux is based on Unix, so it inherits a lot of text-processing support (which is what Unix was originally designed for). There are utilities to slice, dice, reformat, scale, rotate and otherwise manipulate documents in PDF, PS, TeX, and many more text and graphics formats as well.

Customer surveys are for companies who didn't pay proper attention to begin with.
Anil Karamchandan
Ranch Hand

Joined: Sep 12, 2009
Posts: 47
Hi Tim

I am sorry I woke up a zombie here, but I am still not able to solve the problem, actually I am not looking for a viewer/utility by which I can view the pdf, All I am looking for is that for an user action, a pdf which is stored at some location on the server should open and the client could see the pdf and if required click on file - > save as - > ( a local copy)

I have looked on a few sites here and it seems Runtime class could be used only with windows ? or the rundell32 parameter is used only with windows. No one is clearly able to justify or give me the steps on how to achieve this.

the other way out which I have is load the document via a URL.. but I want to keep this as the last resort .

any luck ?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15959

I don't understand.

A standalone application or signed applet could easily invoke a PDF viewer using the Runtime.exec() method, but you would have to know the name and location of the viewer program preferred by the user.

Rundll32 is an abomination designed to allow execution of Windows DLLs as though they were standalone applications. What's abominable about that is that A, it really shouldn't be necessary and B, you don't get an honest accounting of what apps are running in Windows when they're running under cover of rundll32. Microsoft compounded the offense with a similar utility in more recent times, but I can't (and would rather not) recall what it is. Something like svchost.exe, I think. Civilized OS's (and I don't mean only Unix-like ones) don't rely on such kludges. And of all OS's in the Universe, Windows is the very last one that should be running unidentifiable applications.
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

Modern Linuxes allow the usage of the awt.Desktop-class - no need to use Runtime here. You wouldn't know whether to use xpdf, evince, acrobat or whatever.

The same approach should be used for Mac, Solaris or Windows, not rundll, which is platform-dependant.
It is sorta covered in the JavaRanch Style Guide.
subject: How to open a PDF file in linux using java
Similar Threads
how can convert excel to pdf .
storing .pdf files in jsp
problem with opening pdf file on linux machine
convert to pdf file format
what open source can help create PDF file using java ?