0 Replies Latest reply: Apr 30, 2012 2:25 PM by Christy20120425 RSS

    Print and Exit

    Christy20120425 Community Member

      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!