我想一键打印现有的 .pdf 文件。It works fine when i only print one file at a time, but when choose to print multiple files at once it only prints one file.
这是我的代码:
List<string> ListFilePath; //Assume i have a collection of filepath stored here
foreach(string FilePath in ListFilePath)
{
Process proc = new Process();
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
proc.StartInfo.Verb = "print";
proc.StartInfo.FileName = FilePath;
proc.StartInfo.Arguments = String.Format(@"/p /h {0}", FilePath);
proc.StartInfo.CreateNoWindow = true;
proc.Start();
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
if (proc.HasExited == false)
{
proc.WaitForExit(10000);
}
proc.EnableRaisingEvents = true;
proc.Close();
}
我的错在哪里?