Skip to main content
July 30, 2012
質問

How to Print a PDF programmatically without the Adobe Reader Window

  • July 30, 2012
  • 返信数 3.
  • 111392 ビュー

Hi,

I'm trying to print a PDF my application. I would prefer to do it as silent as possible - no PrintDialogue | Adobe Reader Window.

  • Language C#
  • Adobe Reader 10.0

Here´s some Code:

    public static void PrintPDF(string file, string printerName)
    {
        Process proc = new Process();
        proc.StartInfo.FileName = @"C:\Program Files (x86)\Adobe\Reader 10.0\Reader\AcroRd32.exe";
        proc.StartInfo.Arguments = @" /t /h " + "\"" + file + "\"" + " " + "\"" + printerName + "\"";
        proc.StartInfo.UseShellExecute = true;
        proc.StartInfo.CreateNoWindow = true;
        proc.Start();
        Thread.Sleep(1000);
        proc.WaitForInputIdle();
       

proc.Kill();

    }

It works, but the Adobe Reader Window is still popping up -> /h (start the reader minimized) does not work.

Is there another way to hide the Window ?

Regards

このトピックへの返信は締め切られました。

返信数 3

ReinhardF
Participating Frequently
July 31, 2012

Hi,

you mixed up the commandline options, so:

AcroRd32.exe /h /t "......."

should work (at least until v9..)

HTH, Reinhard

PS: simple test under START->EXECUTE: AcroRd32.exe /h /p "c:\Test.pdf"

where /p stands for print to standardprinter


lrosenth
Adobe Employee
Adobe Employee
July 30, 2012

Correct - this is so that users don't have stuff printing out of their printers w/o their knowledge.

Using standard Windows techniques for hiding windows or opening apps minimized, if you must.

August 2, 2012

Hi,

I am developing an application, which have to support a PDF print. My result after searching for the best possibilities is this snippet:

    public static void PrintPDF(string path, string printer)
    {
        Process process = new Process();       
        process.StartInfo.FileName = path;
        process.StartInfo.Verb = "printto";
        process.StartInfo.Arguments = "\"" + printerName + "\"";
       

process.Start();

// I have to use this in case of Adobe Reader to close the window

        process.WaitForInputIdle();
        process.Kill();
    }

This is the most generic solution - it prints a pdf unless no matter wich reader is installed.

Only deficit - the Adobe Reader window still pops up. Why it does not behave like it´s alternatives (for example Foxit Reader) and print the PDF without popping up ?

Regards

lrosenth
Adobe Employee
Adobe Employee
August 2, 2012

Because silent printing is a security risk – and unlike our competitors we CARE about security!

MichaelKazlow
Legend
July 30, 2012

Moved to Acrobat SDK