1

I currently am coding a PDF printer for work that is unattended on a server. Basically, we have a PDF file already created... and we are telling ghostscript to Print the document to the printer passed in.

However, the Ghostscript DLL always pops up a dialog showing what it's doing... such as ... Printing page 1... etc....

Screenshot of popup..

I want to have complete silent printing. I've tried -dQUIET ... but that has no affect.

            Dim switches As List(Of String) = New List(Of String)
            With switches
                .Add("-dPrinted")
                .Add("-dBATCH")
                .Add("-dNOPAUSE")
                .Add("-dNOPROMPT")
                .Add("-dNOPAGEPROMPT")
                .Add("-dNOSAFER")
                .Add("-dNumCopies=1")
                .Add("-sDEVICE=mswinpr2")
                .Add("-sOutputFile=%printer%" + strPrinterName)
                If Me.Orientation = PrinterOrientation.vbPRORLandscape Then
                    .Add("-c")
                    .Add("<</Orientation 3>> setpagedevice")
                End If
                .Add("-f")
                .Add(fileName)
            End With

Is there another switch that I'm missing? Or is it not possible to have 0 popup showing the status?

1SG Nitro
  • 23
  • 1
  • 5

2 Answers2

1

The documentation describes (Section 10.1) the -dNoCancel switch:

Hides the progress dialog, which shows the percent of the document page already processed and also provides a cancel button. This option is useful if GS is intended to print pages in the background, without any user intervention.

KenS
  • 30,202
  • 3
  • 34
  • 51
  • What version is that in? 9.23 doesn't show that option under "How to use..." However, I will give it a try. Thanks! – 1SG Nitro Apr 20 '18 at 14:06
  • That worked! Case sensitive. Most of the other commands are capitalized. I did your version and it worked. Thank you!! – 1SG Nitro Apr 20 '18 at 14:10
  • This is the page I was referring too. https://www.ghostscript.com/doc/9.23/Use.htm – 1SG Nitro Apr 20 '18 at 14:17
  • 1
    All the Ghostscript command line switches are case-sensitive (because PostScript is case sensitive). I see my link got messed up and used the local file system, should have been: https://www.ghostscript.com/doc/9.23/Devices.htm#Win which is the page documenting each specific device, in this case the Windows printer device. – KenS Apr 20 '18 at 18:07
  • Bam! Thanks! I see it now. – 1SG Nitro Apr 20 '18 at 19:08
0

If you are on windows you want to ensure that you are running

gswin32c.exe (note the added c for command/console)

OR

gswin64c.exe (note the added c for command/console)

rather than gswin64 or gswin32.

See Ghostscript suppress output windows when called by command line for details.

Nick Painter
  • 720
  • 10
  • 13