Java调用Acrobat Reader后台指定打印机打印PDF文件的方法

论坛 期权论坛 脚本     
匿名技术用户   2020-12-23 04:56   15   0

其实网上都有类似的博文,但大多都是调用默认打印机,所以今天写一篇调用指定打印机的方法

首先要下载第三方软件Acrobat Reader

public static void printPDFTest(String pFile,String pPrinter){
  //注意每个参数中间的参数必须有空格隔开
  String printRW="cmd.exe /C start acrord32.exe  /t "+pFile+" "+pPrinter;
   try {
  int waitFor = Runtime.getRuntime().exec(printRW).waitFor();
  
  System.out.println("[print]:"+printRW);
  } catch (Exception e) {
  // TODO: handle exception
  }
 }
pFile为文件路径

pPrinter为打印机名字


此方法有一个缺点,就是运行的时候会弹出软件窗口.其实原理就是模拟手工操作.


分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:7942463
帖子:1588486
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP