I want to print a PDF file on a Windows network printer through GhostScript.
(I do not want to use Adobe Reader)
I read gswin32c.exe which can do the job.
I experimented with many commands and could not find a way to get gs to print PDF on my (default) network drive.
I do not need a dot network printer - by default, you can use the default. But if there is no such option, I will gladly pass the name of the printer. (I tried with the -SDevice = "\ server_IP \ terminal_name" option, but that didn't work either ...)
Command running under Windows cmd:
gswin32c -dPrinted -dBATCH -dNOPAUSE -dNOSAFER -q -dNumCopies=1 -sDEVICE=ljet4 -sOutputFile="\\spool\\\Server_Name\Printer_name" "C:\test.pdf"
The method created by the database above does not work and excludes. (Error code = 1)
/// <summary> /// Prints the PDF. /// </summary> /// <param name="ghostScriptPath">The ghost script path. Eg "C:\Program Files\gs\gs8.71\bin\gswin32c.exe"</param> /// <param name="numberOfCopies">The number of copies.</param> /// <param name="printerName">Name of the printer. Eg \\server_name\printer_name</param> /// <param name="pdfFileName">Name of the PDF file.</param> /// <returns></returns> 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; }
Any idea how to make it work under C #?
c # printing pdf ghostscript
Maciej Apr 08 '10 at 12:52
source share