title: How to print PDF on default network printer using GhostScript (gswin32c.exe) shell command
body: <p>I'd like to print PDF file(s) on windows' network printer via GhostScript.<br>
  (I dont want to use Adobe Reader)  </p>
  
  <p>I've read <strong>gswin32c.exe</strong> which can do the job.<br>
  I experimented with many commands and coudn't find the way how to force gs to print PDF on my (windows default) network drive.   </p>
  
  <p>I don't need point exact network printer- default can be used. But if there is no such option I'm happy to pass printer name as well. (I've tried with param -SDevice="\server_IP\printer_name" but this didnt work as well...)</p>
  
  <p>Command working under Windows cmd:</p>
  
  <pre><code>gswin32c -dPrinted -dBATCH -dNOPAUSE -dNOSAFER -q -dNumCopies=1 -sDEVICE=ljet4 -sOutputFile="\\spool\\\Server_Name\Printer_name" "C:\test.pdf"
  </code></pre>
  
  <p>Method created base on above - doesnt work and thorws exception. (Error code = 1)  </p>
  
  <pre><code>    /// &lt;summary&gt;
      /// Prints the PDF.
      /// &lt;/summary&gt;
      /// &lt;param name="ghostScriptPath"&gt;The ghost script path. Eg "C:\Program Files\gs\gs8.71\bin\gswin32c.exe"&lt;/param&gt;
      /// &lt;param name="numberOfCopies"&gt;The number of copies.&lt;/param&gt;
      /// &lt;param name="printerName"&gt;Name of the printer. Eg \\server_name\printer_name&lt;/param&gt;
      /// &lt;param name="pdfFileName"&gt;Name of the PDF file.&lt;/param&gt;
      /// &lt;returns&gt;&lt;/returns&gt;
      public bool PrintPDF (string ghostScriptPath, int numberOfCopies, string printerName, string pdfFileName) {
          ProcessStartInfo startInfo  = new ProcessStartInfo();
          startInfo.Arguments         = " -dPrinted -dBATCH -dNOPAUSE -dNOSAFER -q -dNumCopies=" + Convert.ToString(numberOfCopies) + " -sDEVICE=ljet4 -sOutputFile=\"\\\\spool\\" + printerName + "\" \"" + pdfFileName + "\"";
          startInfo.FileName          = ghostScriptPath; 
          startInfo.UseShellExecute   = false;
  
          Process process = Process.Start(startInfo);
  
          return process.ExitCode == 0;
      }
  </code></pre>
  
  <p>Any idea how to make it working under C#?</p>