3

I used this code to print a pdf file from acrobat reader.

private void SendToPrinter()
{
    ProcessStartInfo info = new ProcessStartInfo();
    info.Verb = "print";
    info.FileName = @"c:\output.pdf";
    info.CreateNoWindow = true;
    info.WindowStyle = ProcessWindowStyle.Hidden;

    Process p = new Process();
    p.StartInfo = info;
    p.Start();

    p.WaitForInputIdle();
    System.Threading.Thread.Sleep(3000);
    if (false == p.CloseMainWindow())
        p.Kill();
}

However, it prints through default printer.

How can I select the printer to send it to? default.

I have tried with a property for ex: info.Arguments, but that doesn't work.

NotMe
  • 87,343
  • 27
  • 171
  • 245
user1238798
  • 145
  • 2
  • 3
  • 5

2 Answers2

3

Use the /t command line argument to force adobe to use a specific printer:

AcroRd32.exe /t path "printername" "drivername" "portname"

See the PDF developer FAQ for more info: http://partners.adobe.com/public/developer/en/acrobat/sdk/pdf/intro_to_sdk/DeveloperFAQ.pdf

John Koerner
  • 37,428
  • 8
  • 84
  • 134
1

How about using the "printto" verb? pasing "\\\server\printer" for info.Arguments

Steven P
  • 1,956
  • 1
  • 16
  • 17
  • Close, but the complete answer is shown at the following SO article: http://stackoverflow.com/a/5432909/964043 – dmarietta Mar 16 '16 at 23:43