2
下面的代碼至少完美的作品打印在Windows 7中的PDF文件,但被吹在Windows 8中的錯誤:Windows 8打印錯誤的C#進程打印PDF文件,如何?
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)
我知道有一個土坯閱讀器的PDF文件無論如何,但堅持我需要在Windows 8上工作,所以這個錯誤不會再發生。
編輯,現在這是在Windows 8怪異: printto不被識別爲一個內部或外部命令
我試着用搜索引擎這一點,但我驚呆了沒有結果上來。 我想要做的就是將我的文檔編程打印到特定的打印機。
當我點擊一個PDF文件並認爲它是Adobe時,它確實對我有誤導,因爲它確實是Windows 8的普通PDF查看器,它實際上沒有文件關聯。一旦我安裝了Adobe reader,並使用print命令假定使用它的默認打印機。那麼我可能需要爲舊的printto.exe文件保留那些不是默認打印機的副本。 – jfalberg
沒有printto.exe文件。有一個動詞printto與.pdf擴展名關聯。 –
我已經安裝了AdobeReader,並將其與pdf關聯,但這不起作用。它只是拋出:「指定的可執行文件不是該OS平臺的有效應用程序。」例外 –