Wings
Wings

Reputation: 75

Opening a PDF in a desktop application in Java

Is it possible to open or create a PDF file in a Java desktop application just like we can create text file?

From my search I got that it is possible only with web java. Is that true?

Upvotes: 3

Views: 4267

Answers (4)

mark stephens
mark stephens

Reputation: 3184

There is an OS PDF plugin for Netbeans at http://www.jpedal.org/support_siNetBeans.php

Upvotes: 1

CloudyMarble
CloudyMarble

Reputation: 37566

You can not create PDF just like a normal Text file, you will need PDF Library to create one. Opening an existing PDF is possible like *a_horse_with_no_name* mentioned in his answer.

You can find some PDF Libraries here.

Upvotes: 0

user330315
user330315

Reputation:

To open an existing PDF file in the desktop default reader you can use the following code:

File pdf = new File("/path/to/your.pdf");
Desktop.getDesktop().open(pdf);

(needs Java 6)

Upvotes: 5

Ocaso Protal
Ocaso Protal

Reputation: 20247

You can use iText to do this. Here is a nice tutorial.

Upvotes: 3

Related Questions