0

my Evironment is Windows10 64bit ,VS2015 ,GhostScript9.27, Language is C# And i using GhostScript.net to invoke GhostScript

here is my code

string inputFile = "D:\\112.pdf";
string outputFile = "D:\\output.pdf";
GhostscriptProcessor ghostscript = new GhostscriptProcessor();

 List<string> switches = new List<string>();

 switches.Add("-o");
 switches.Add(outputFile);

 switches.Add("-dNoOutputFonts");

 switches.Add("-sDEVICE=pdfwrite");

 switches.Add(inputFile);

 ghostscript.Process(switches.ToArray());

and i try the script by the windows CMD Window

"gswin64.exe -o D:\output.pdf -dNoOutputFonts -sDEVICE=pdfwrite D:\112.pdf"

it works,

but when i run it in C# by GhostScript.net , it always give error

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

did anybody knows? thanks a lot for your help

steive
  • 11
  • 5
  • THis isn't really a Ghostscritp question, since Ghostscript itself works. Error code -100 is gs_error_Fatal, which essentially means 'something truly bad happened'. My immediate thought would be that you haven't specified a switch[0], I dn't know if Ghostscript.NET will do that for you. Try putting switches.Add("-dNothing"); as the **first** switch and then add the others. – KenS Jul 07 '19 at 13:14
  • @Kens ,thanks your advise, it works when add "-dNothing" and there is another way is add "gs" . but meet another problem is if the fileName Contains chinese characters , not work – steive Jul 08 '19 at 01:05

0 Answers0