[英]Error Printing: No application is associated with the specified file for this operation
I have a VB WinForms app that prints PDFs using Process.Start, and it has been working fine for ages on Windows 10. Today I go to use it and get the following error message: 我有一个VB WinForms应用程序,该应用程序使用Process.Start打印PDF,并且在Windows 10上已经运行了很长时间。今天,我去使用它并得到以下错误消息:
"No application is associated with the specified file for this operation" “没有应用程序与此操作指定的文件关联”
Nothing has changed to cause this, I have not changed PDF Viewer or uninstalled anything. 没有任何改变导致此,我没有改变PDF Viewer或卸载了任何东西。 I can open a PDF by double clicking on it no problems.
我可以双击打开PDF,没有问题。
I wrote a small console app to replicate the issue and prove this had nothing to do with the WinForms app: 我编写了一个小型控制台应用程序来复制问题,并证明这与WinForms应用程序无关:
Sub Main()
Dim pi As New Diagnostics.ProcessStartInfo
Dim url As String = "C:\PathToPDF\.pdf"
pi.FileName = url
pi.Verb = "PrintTo"
pi.CreateNoWindow = True
pi.Arguments = """Microsoft Print to PDF"""
pi.UseShellExecute = True
Console.WriteLine(url)
Diagnostics.Process.Start(pi)
Console.ReadKey()
End Sub
The above program replicates the error. 上面的程序复制了错误。 I have verified that the file exists and is accessible and tried it with double slashes and single slashes, they give the same error:
我已经验证了该文件存在并且可以访问,并使用双斜杠和单斜杠对其进行了尝试,它们给出了相同的错误:
"No application is associated with the specified file for this operation". “没有应用程序与此操作指定的文件关联”。
The same application is working fine on other PCs in the office. 相同的应用程序在办公室的其他PC上运行正常。 Has anyone else had this happen, and if so how did they fix it?
有没有其他人发生过这种情况,如果是这样,他们如何解决? My PDF viewer is PDFXChange Viewer, and it has been working fine PDFs printed using this method for years.
我的PDF查看器是PDFXChange Viewer,并且使用这种方法打印的PDF多年来一直可以正常工作。 I have not updated the program, and it says in the about page that the last installed updated was in 2016.
我尚未更新程序,它在“关于”页面中表示上次安装的更新是在2016年。
Regards. 问候。
If I am right, I had the same issue. 如果我是对的,我也有同样的问题。 Maybe you can try it in a slightly other way.
也许您可以以其他方式尝试。 I have this in my application and it works fine:
我在我的应用程序中有它,它工作正常:
Dim myp As New Process
myp.StartInfo.FileName = filename 'Full path to pdf
myp.Start()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.