【发布时间】:2015-08-06 09:20:13
【问题描述】:
我想从 WCF 服务打印 PDF 或图像。
我使用 acrobat 打印 pdf throw 进程,它与控制台应用程序一起使用,但不适用于 Windows 或 IIS 托管的 WCF 服务。 我使用以下代码进行打印。
Process proc = new Process();
string file = @"E:\FormValidation.pdf";
string printerName = @"\\claysys036\Canon LBP2900";
proc.StartInfo.FileName = @"C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe";
proc.StartInfo.Arguments = @" /t /h " + "\"" + file + "\"" + " " + "\"" + printerName + "\"";
proc.StartInfo.UseShellExecute = true;
proc.StartInfo.CreateNoWindow = true;
proc.Start();
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
if (proc.HasExited == false)
{
proc.WaitForExit(10000);
}
proc.EnableRaisingEvents = true;
proc.Kill();
【问题讨论】: