An error occured when call to 'gsapi_init_with_args' is made: -100

May 8, 2014 at 1:43 PM
Edited May 8, 2014 at 1:44 PM
i use the dll convert the ps file to pdf ,follow is my code
     //   GhostscriptVersionInfo gv = new GhostscriptVersionInfo(@"C:\SharePrinter\gsdll32.dll");
        GhostscriptVersionInfo gv = GhostscriptVersionInfo.GetLastInstalledVersion();
        GhostscriptProcessor processor = new GhostscriptProcessor(gv, true);
        List<string> switches = new List<string>();
        switches.Add("-sOutputFile=" + txtFilename);
        processor.StartProcessing(switches.ToArray(), null);
i get An error occured when call to 'gsapi_init_with_args' is made: -100
May 8, 2014 at 2:10 PM

Can you try to remove txtFilename and use hardcoded paths? It could be your path is not correct. A same for psFilename.

Is txtFilename a string variable or textbox control? If it's textbox control then you should use "txtFilename.Text".

It could also be that that postscript file is not valid or buggy. You can check it out by trying to open it via GSView (

May 8, 2014 at 2:22 PM
You can also use this code to trap Ghostscript errors:
        public class GsStdio : GhostscriptStdIO
            public GsStdio() : base(true, true, true) { }

            public override void StdIn(out string input, int count)
                input = string.Empty;

            public override void StdOut(string output)
                System.Diagnostics.Debug.WriteLine("GS out: " + output);

            public override void StdError(string error)
                System.Diagnostics.Debug.WriteLine("GS err: " + error);
and then instead of
processor.StartProcessing(switches.ToArray(), null);
processor.StartProcessing(switches.ToArray(), new GsStdio());
May 9, 2014 at 1:20 AM
Edited May 9, 2014 at 1:41 AM
josip thanks for your quick replay.

i follow your suggest ,use the file path not parameter

i find it work.

the failure reason is the ps file name contains some chinese language ,such as my ps flle name ( Microsoft Word - 辅助办公系统 )

the gsstdio out is
GS out: Error: /undefinedfilename
GS out:  in (C:\\SharePrinter\\Temp\\20140509\\Microsoft Word - \350\276\205\345\212\251\345\212\236\345\205\254\347\263\273\347\273\237
GS out: 2014)
GS out: 
Operand stack:

Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopp
GS out: ed_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push
Dictionary stack:
GS out: ro)(G)--   --dict:0/20(G)--   --dict:77/200(L)--
Current allocation mode is local
Last OS error: No such file or directory

GS err: GPL Ghostscript 
i want to know ,the ps file can not cotains chinese language such as
Microsoft Word - 辅助办公系统
how to resolve this problem?

thanks very much.
May 9, 2014 at 5:55 AM
Can you please tell me which versions of native Ghostscript library and Ghostscript.NET you use?
May 13, 2014 at 1:30 AM
Ghostscript.NET v.1.1.8

ghostscript 9.14