打印.docx文件而不在c#中显示额外的打印窗口

时间:2018-07-26 08:19:10

标签: c# printing docx

我编写了以下代码以使用c#打印文件:

    ProcessStartInfo info = new ProcessStartInfo(filePath);
    info.Verb = "Print";
    info.Arguments = pdi.PrinterSettings.PrinterName;
    info.CreateNoWindow = true;
    info.WindowStyle = ProcessWindowStyle.Hidden;    
    Process.Start(info);

此代码正常工作。但是它显示了一个打印窗口。为了隐藏窗口,我添加了额外的一行:info.UseShellExecute = false; 然后我的程序抛出异常:

the specified executable is not a valid application for this os platform.

我正在尝试打印我的docx文件而不显示任何额外的打印窗口。

0 个答案:

没有答案