コード例 #1
0
 /// <summary>
 /// 打印PDF文件
 /// </summary>
 /// <param name="printer_name"></param>
 /// <param name="file_path"></param>
 /// <param name="ax_acropdfunit"></param>
 /// <returns></returns>
 public static string print(string printer_name, string file_path, AxAcroPDF ax_acropdfunit)
 {
     try
     {
         if (!printer_name.isNull())
         {
             string default_printer = PrintUtil.defaultPrinter();
             if (default_printer != printer_name)
             {
                 PrintUtil.setDefaultPrinter(printer_name);
                 while (PrintUtil.defaultPrinter() != printer_name)
                 {
                     Thread.Sleep(50);
                 }
                 Thread.Sleep(1000);
             }
         }
         ax_acropdfunit.LoadFile(file_path);
         ax_acropdfunit.printAllFit(true);
         return("");
     }
     catch (Exception ex) { return(ex.ToString()); }
 }