Hello to all,
We have built an application that receives several files in different formats, pdf, tiff, jpgeg, doc, etc. After received, they are converted to tiff files using a third party printing driver which is installed locally on the server and set up as the default printer. In order to do that we open a System.Diagnostics.Process with the command line and arguments to print the file with the appropriate application.
Now the new version needs to be a Windows Service and so far everything is working fine, except the printing part. Whenever the process starts, it never raises an exception and everything seems to be working fine, but the file is never printed out. If I open Task Manager I can see that MS Paint was executed (in case of a jpeg file), but no output tiff file.
As a side note, the final file needs to be a tiff file because of another third party tool our customer uses and that is the only format it supports.
Any help will be greatly appreciated. Sergio Romero
The code we're using is as follows:
private const string PROCESS_COMMAND = "mspaint.exe";
private const string PROCESS_ARGUMENTS = @"""{0}""";
Process proc = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo();
string error = string.Empty;
startInfo.FileName = PROCESS_COMMAND;
startInfo.Arguments = string.Format(PROCESS_ARGUMENTS, fileFullPath);
startInfo.UseShellExecute = false;
startInfo.RedirectStandardError = true;
proc.EnableRaisingEvents = false;
proc.StartInfo = startInfo;
proc.Start();
using(StreamReader errorReader = proc.StandardError)
{
string standardError = string.Empty;
while((standardError = errorReader.ReadLine()) != null)
{
error += standardError + " ";
}
}
proc.WaitForExit();