Hi,
I am having issue after printing a pdf file. An Adobe reader window is opening after printing a pdf file but its not closing. Please help me to prevent the opening of this window or to close it immedeately after printing. Below is my piece of code.
public bool PrintPdfFile(string PdfFilePath)
{
try
{
Process MyProcess = new Process();
MyProcess.StartInfo.CreateNoWindow = false;
MyProcess.StartInfo.Verb = "print";
MyProcess.StartInfo.FileName = PdfFilePath;
MyProcess.Start();
MyProcess.WaitForExit();
MyProcess.CloseMainWindow();
MyProcess.Close();
return true;
}
catch (Exception ex)
{
GlobalVariables.strTraceErrorMsg = "Exception Occured in Method *PrintPdfFile*. Error message:" + ex.Message;
if (GlobalVariables.strLogIsRequired == GlobalVariables.strLogYes)
objCommanFunc.LogEventToTextFile(GlobalVariables.strTraceMsg, GlobalVariables.strFilePath);
string strErrorMsgContractNote = ex.Message;
objCommanFunc.LogEventToEventViewer(strErrorMsgContractNote);
return false;
}
}