I have C# program, which sends uses PrintTo verb when spawning process to print file to specified printer. However, when I try to print .pdf or html file, it says
Unhandled Exception: System.ComponentModel.Win32Exception: No application is associated with the specified file for this operation
at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
I have PDF Complete installed and double clicking on pdf file opens it correctly. Same things happens with .html file (I have Mozilla Firefox as default browser).
EDIT:
My code:
ProcessStartInfo info = new ProcessStartInfo(args[0]);
info.Arguments = "\"" + args[1] + "\"";
info.CreateNoWindow = true;
info.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
info.UseShellExecute = true;
info.Verb = "PrintTo";
Process.Start(info);
And command line call: >myapp.exe D:\Temp\test.pdf "PDF Complete"
For example >myapp.exe D:\Temp\test.txt "PDF Complete" works
start test.pdfalso works.