The following code at least works perfectly printing a pdf file in Windows 7, but is blowing an error in 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();
Here are some details of the error:
************** 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)
I know there's an adobe reader for pdf files anyways but am stuck as to what I need to get working on Windows 8 so this error doesn't happen again.
edit, now this is weird in Windows 8: printto is not recognized as an internal or external command
I tried googling this but am shocked no results come up. All I want to do is programmically print my document to a specific printer.