1
Vote

Printer Dialog Showing

description

Hi,
I'm using the latest NuGet of GS.Net ( 1.2.1 ) and I think I have all the parameters correct but it still keeps showing the dialog.

If I run the command (that I log ex: bellow ) in the cmd with the gswin64c it runs as it supposes to, so my guess is that the parameters are correct.

My code is :
            var gsVi =   GhostscriptVersionInfo.GetLastInstalledVersion();

            if (gsVi == null)
                throw new Exception("GhostScript instalation not found.");

            _gsP = new GhostscriptProcessor(gsVi, false);
            List<string> gsArgs = new List<string>
            {
                "-empty", 
                "-dBATCH",
                "-dNOPAUSE",
                "-dNOSAFER",
                "-dPrinted",
                "-dNumCopies=1",
                $"-sDEVICE={printDevice}",
                $"-sOutputFile=\"%printer%{printerName}\"",
                "-f",
                filePathToPrint
            }; 
            try
            { 
                WriteOutput("GHOSTSCRIPT NET -  " + string.Join(" ", gsArgs));
 
                OutputStdIo cstdio = new OutputStdIo(true, true, true);
                
                _gsP.Process(gsArgs.ToArray(), cstdio);
 
                WriteOutput("cstdio " + cstdio.Output);
            }
            catch (GhostscriptAPICallException gs)
            {
                // Can throw if user cancel Printer dialog - "An error occured when call to 'gsapi_init_with_args' is made: -100"
                // Can throw if arguments wrong
                WriteOutput(gs);
            }
and it outputs this (if I don't cancel in the printer dialog):
_______________________________________________________
:: APP :: 02/07/2017 18:10:59 ---------------
 GHOSTSCRIPT NET -  -empty -dBATCH -dNOPAUSE -dNOSAFER -dPrinted -dNumCopies=1 -sDEVICE=mswinpr2 -sOutputFile="%printer%EPSON" -f C:\Jobs\3bf268fa3dc343af831b5dc7a9df1b49\Job.ps
 
_______________________________________________________
:: APP :: 02/07/2017 18:11:01 ---------------
 cstdio GPL Ghostscript 9.19 (2016-03-23)
Copyright (C) 2016 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Loading NimbusMono-Regular font from %rom%Resource/Font/NimbusMono-Regular... 4380408 2855111 1554744 270788 1 done.
%%[ ProductName: GPL Ghostscript ]%%
%%[Page: 1]%%
%%[LastPage]%%

comments