0

Click a button then print PDF file without opening the acrobat reader. How to do that in VB.net 2013?

The code below works, but it opens acrobat reader first then print.

Dim proc As Process = Process.Start("AcroRd32.exe", _
                              String.Format("/N /T {0} ""{1}""", _
                              "C:\Path\to\201402124_label.pdf", "Brother QL-700")
Filburt
  • 17,626
  • 12
  • 64
  • 115

2 Answers2

0

Use the /h switch to open AcroRd32.exe <filename> as a minimized window. You can find more info in the Adobe Developer FAQ doc.

ɐsɹǝʌ ǝɔıʌ
  • 4,440
  • 3
  • 35
  • 56
0

You can try this: (c#)

    public static Boolean PrintPDFs(string pdfFileName)
    {
        try
        {
            Process proc = new Process();
            proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
            proc.StartInfo.Verb = "print";

            //Define location of adobe reader/command line
            //switches to launch adobe in "print" mode
            proc.StartInfo.FileName = @"C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe";
            proc.StartInfo.Arguments = String.Format(@"/p /h {0}", pdfFileName);
            proc.StartInfo.UseShellExecute = false;
            proc.StartInfo.CreateNoWindow = false;

            proc.Start();
            proc.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
            if (proc.HasExited == false)
            {
                proc.WaitForExit(10000);
            }

            proc.EnableRaisingEvents = true;

            proc.Close();
            KillAdobe("AcroRd32");
            return true;
        }
        catch
        {
            return false;
        }
    }
R-C
  • 16
  • 1