/*
* Open a PDF file in new window using JAVA
*/
import java.awt.Desktop;
import java.io.File;
public class OpenPDF {
public static void main(String[] args) {
try {
File pdfFile = new File("c:\\sample.pdf"); //give your PDF location
if (pdfFile.exists()) {
if (Desktop.isDesktopSupported()) {
Desktop.getDesktop().open(pdfFile);
} else {
System.out.println("Awt Desktop is not supported");
}
} else {
System.out.println("File is not exists!");
}
System.out.println("Done");
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
Output
~~~~~~
Done
Note: it open a PDF file in separate window
Subscribe to:
Post Comments (Atom)
Backup files to google drive using PHP coding
Dear All, To backup files to Google Drive using PHP coding, you can use the Google Drive API and the Google Client Library for PHP. Here...
-
Dear All, To backup files to Google Drive using PHP coding, you can use the Google Drive API and the Google Client Library for PHP. Here...
-
Hi ALL, Here I wrote a program for Void Method in java. /** * * @author Balamurgan M */ public class voidMethod { ...
-
Hi ALL, Here I wrote a program for Relational Operator And Conditional Operator in java. /** * * @author Balamurgan M ...
No comments:
Post a Comment