Quantcast
Channel: Adobe Community : Unanswered Discussions - Acrobat
Viewing all articles
Browse latest Browse all 73766

print PDF using c#

$
0
0

Hi,

 

I have a program written in c# that creates several PDF on the HDD. When the creation of de documents(PDF) is finished it needs to print the PDF. On some locations this works and on others it doesn't. But with a weird adjustment it works on every location. Here is the code used. I could use a bit of an explanation why.

 

 

This code works on some locations :

Process myProcess = new Process();

myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;

myProcess.StartInfo.Verb = "Print";

myProcess.StartInfo.FileName = fileName;

myProcess.StartInfo.CreateNoWindow = true;

myProcess.Start();              

myProcess.WaitForInputIdle();

myProcess.Kill();

myProcess.Close();

 

 

This code works on every location :

Process myProcess = new Process();

myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;

myProcess.StartInfo.Verb = "Print";

myProcess.StartInfo.FileName = fileName;

myProcess.StartInfo.CreateNoWindow = true;

myProcess.Start();              

myProcess.WaitForInputIdle();

myProcess.WaitForExit(10000); --> this is added, but it is not correct programming

myProcess.Kill();

myProcess.Close();

 

So i would like to find out why "myProcess.WaitForInputIdle();" isn't always working.

 

thx in advance


Viewing all articles
Browse latest Browse all 73766

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>