Skip navigation
Christy20120425
Currently Being Moderated

Print and Exit

Apr 30, 2012 2:25 PM

Tags: #acrobat #print #exit #minimize

I am trying to allow users to print a list of documents that can be of several types, including pdf, in an application written in C#. When the files have a pdf extension, I use the /t command line for AcroRd32.exe to print.

 

  
string strExecutable = @"C:\Program Files (x86)\Adobe\Reader 10.0\Reader\AcroRd32.exe"; 
string strArguments = "/t \"" + strFileAddress + "\" \"" + printer + "\"";
    
Process procPDF = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo(strExecutable, strArguments);  
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
procPDF.StartInfo = startInfo;
procPDF.Start();
Thread.Sleep(1000);
 
procPDF.WaitForExit(1000);
procPDF.Close();
 

However, this is giving me two problems:

  1. Acrobat remains open after printing unless I specifically kill the process. If I kill it too early, however, I also stop printing any files that have not been sent to the printer yet.
  2. Acrobat pops up in front of my application, even though the WindowStyle for my Process is set to Hidden.  For the first item printed, Acrobat remains up briefly and then disappears.  However, if I print several pdf's, Acrobat eventually remains open in front of my application with no file displayed inside it.

 

So, my two questions are

  1. Is there a 'Print and Exit' option like there is on some other readers?
  2. Is there a way to open Acrobat already minimized when printing so the user only sees it in the tray?

 

Thanks!

 

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points