Как да отворим PDF файл в Java


В примера , ще използваме “rundll32″ за да заредим pdf файл, това работи само под Windows

exec("rundll32 url.dll,FileProtocolHandler c:/Java-Interview.pdf");
package com.mkyong.io;
 
public class AppPDF {
 
  public static void main(String[] args) {
 
    try{
 
	  Process p = Runtime.getRuntime().exec(
"rundll32 url.dll,FileProtocolHandler c:/Java-Interview.pdf");
	  p.waitFor();
 
	  System.out.println("Done");
 
     }catch(Exception ex){
	  ex.printStackTrace();
     }
  }
}

Popularity: 1% [?]

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

You can leave a response, or trackback from your own site.

Leave a Reply

Задвижван с помощта на WordPress | Compare Cell Phone Plans at iCellPhonePlans.com | Thanks to Cheap Palm Pixi, Bromoney and Wordpress Themes