0
votes

I must provide a silent print of PDF to physical printer. I'm using ghostscript but I have a problem: the windows default printer settings are ignored by ghostscript.

For example if I select color to b/w or paper tray in default printer settings these are ignored during the print. If I let user select the printer with printer dialog, it works, but I need a silent print.

This is my C# Code, it is linked to ghostscript with Ghostscript.NET library

            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=" + nrcopies);
                switches.Add("-sDEVICE=mswinpr2");
                if (!String.IsNullOrWhiteSpace(printerName))
                    switches.Add("-sOutputFile=%printer%" + printerName);
                switches.Add("-f");
                switches.Add(inputFile);

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

1 Answers

0
votes

I found this solution, another switch for ghostcript:

switches.Add("-dQueryUser=3");