Windows 8在打印pdf文件的c#过程中出错,如何处理?

Windows 8在打印pdf文件的c#过程中出错,如何处理?,c#,pdf,printing,process,C#,Pdf,Printing,Process,以下代码至少可以在Windows 7中完美打印pdf文件,但在Windows 8中出现错误: Process process = new Process(); //process.StartInfo.CreateNoWindow = true; process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; process.StartInf

以下代码至少可以在Windows 7中完美打印pdf文件,但在Windows 8中出现错误:

                Process process = new Process();
            //process.StartInfo.CreateNoWindow = true;
            process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
            process.StartInfo.FileName = defFile;
            if (rwPrinter.Length > 0)
            {
                process.StartInfo.Verb = "printto";
                process.StartInfo.Arguments = "\"" + rwPrinter + "\"";
            }
            else
            {
                process.StartInfo.Verb = "print";
            }
            process.Start();
以下是错误的一些详细信息:

************** Exception Text **************
System.ComponentModel.Win32Exception (0x80004005): 
No application is associated with       the specified file for this operation
at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at ECitation.Form1.process_ticket(String jobdo)
at ECitation.Form1.btnPrint_Click(Object sender, EventArgs e)
我知道有一个AdobeReaderforPDF文件,但我一直在思考在Windows8上工作需要什么,所以这个错误不会再次发生

编辑,现在这在Windows 8中很奇怪: 无法将printto识别为内部或外部命令

我试着用谷歌搜索这个,但很震惊没有结果。
我所要做的就是通过编程将我的文档打印到特定的打印机。

错误消息告诉您需要知道的一切。没有为.pdf文件扩展名上的printto谓词定义任何内容。如果您想让这种方法起作用,您需要配置文件关联来解决这个问题


您尝试这样做的方式非常脆弱,因为它依赖于第三方PDF查看器的模糊性。如果控制应用程序运行的所有计算机,则可以根据需要配置PDF查看器。否则,您将需要处理大量的客户支持。一个更强大的解决方案是使用提供PDF打印功能的众多库中的一个将PDF打印功能构建到应用程序中。

当我点击PDF文件并认为它是Adobe时,这肯定会误导我,而实际上它是Windows 8的通用PDF查看器,没有文件关联。一旦我安装了AdobeReader并使用print命令假定使用默认打印机,它就可以工作了。我可能需要保留一份旧的printto.exe文件的副本,用于那些没有默认为该打印机的打印机。没有printto.exe文件。有一个动词printto与.pdf扩展名关联。我安装了AdobeReader并将其与pdf关联,但这不起作用。它只是抛出:“指定的可执行文件不是此操作系统平台的有效应用程序。”异常