开始打印过程 - 找不到应用程序

时间:2017-02-04 13:27:55

标签: c# file pdf printing process

当我尝试打印pdf文件时,我遇到了问题。我收到一条错误消息,指出该应用程序不存在。有任何想法吗?这是我的代码。 更新: 打印和打印失败,同样的错误..

 if (!File.Exists(filename))
 {
      Console.WriteLine("The file is not found");
      return;
 }
 ProcessStartInfo info = new ProcessStartInfo();
 info.FileName = filename;
 info.Arguments = "\"" + printer + "\"";
 info.CreateNoWindow = false;
 info.WindowStyle = ProcessWindowStyle.Hidden;
 info.UseShellExecute = true;
 info.Verb = "printto";
 info.WorkingDirectory = System.IO.Path.GetDirectoryName(filename);
 try
 {
      System.Diagnostics.Process.Start(info);
 }
 catch (Exception ex)
 {
      Console.WriteLine(ex);
 }

错误信息:

Exception thrown: 'System.ComponentModel.Win32Exception' in System.dll
System.ComponentModel.Win32Exception (0x80004005): Application not found
   at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
   at myControl.Print.SendToPrinter(String filename, String printer)

0 个答案:

没有答案
相关问题