ArtifexSoftware / Ghostscript.NET

Ghostscript.NET - managed wrapper around the Ghostscript library (32-bit & 64-bit)
https://ghostscript.com
GNU Affero General Public License v3.0
391 stars 152 forks source link

Silently Print #99

Open qqw1943 opened 2 years ago

qqw1943 commented 2 years ago

hello. i am a new c# learner. when i try to print a pdf file using the example below:

using (GhostscriptProcessor processor = new GhostscriptProcessor())
            {
                List<string> switches = new List<string>();
                switches.Add("-empty");
                switches.Add("-dPrinted");
                switches.Add("-dBATCH");
                switches.Add("-dNOPAUSE");
                switches.Add("-dNOSAFER");
                switches.Add("-dNumCopies=1");
                switches.Add("-sDEVICE=mswinpr2");
                switches.Add("-sOutputFile=%printer%" + printerName);
                switches.Add("-f");
                switches.Add(inputFile);

                processor.StartProcessing(switches.ToArray(), null);
            }

there's always a dialog (see pic in attach files). but i need a Silently Print,which means no dialog is needed can i get some help here ? thank you. QQ截图20220411180751

brothers-morrison commented 2 years ago

same problem here

litao198610 commented 1 year ago

same problem here,can you give me some advice

MAButz commented 1 year ago

Hi ist late, but maybe it still helps.

The Pirntername has spaces!

Try to use switches.Add("-sOutputFile=\"%printer%" + printerName + "\"" );