Advertisement
Tician

C# print pdf-files + close Adobe Reader

Sep 26th, 2016
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.60 KB | None | 0 0
  1. using System.Diagnostics;
  2.  
  3.                 ProcessStartInfo info = new ProcessStartInfo();
  4.                 info.Verb = "print";
  5.                 info.FileName = "C:\\Temp\\abcde.pdf";
  6.                 info.CreateNoWindow = true;
  7.                 info.WindowStyle = ProcessWindowStyle.Hidden;
  8.  
  9.                 Process p = new Process();
  10.                 p.StartInfo = info;
  11.                 p.Start();
  12.  
  13.                 p.WaitForInputIdle();
  14.                 System.Threading.Thread.Sleep(3000);
  15.                 if (false == p.CloseMainWindow()) //if (!p.CloseMainWindow())
  16.                     p.Kill();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement