I have a Windows Application written in C# VS 2008. The purpose of this application is to convert any file to PDF files. I have found code that works on converting the files however there is a small issue that I am coming across.
First here is the code:
private void PrintToAdobePDF(string strInputFilePath)
{
ProcessStartInfo pProcInfo = new ProcessStartInfo();
bool blResult;
blResult = SetDefaultPrinter(D2P_Adobe_Printer);
if (blResult)
{
pProcInfo.FileName = strInputFilePath;
pProcInfo.Verb = "Print";
pProcInfo.CreateNoWindow = true;
pProcInfo.WindowStyle = ProcessWindowStyle.Hidden;
Process pProc = Process.Start(pProcInfo);
pProc.WaitForExit(1000);
pProc.CloseMainWindow();
pProc.Close();
}
The issue I am having is that when the Process.Start() method is invoke it is running with TWO verbs instead of the one verb I specified ("Print"). It is running "Open" and "PrintTo" which is making the application that the original file is derived from open up and hang the application (i.e. jpg opens the Windows Fax and Picture Viewer). My question is how do I just use the "Print" verb within the Process.Start() method?
Thank you in advance