Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SOLVED: gsapi_init_with_args is made: -100


I'm trying to build a PostScript to PDF Converter using Ghostscript.Net. The Args that GetArgs return, are the ones I usually use to call gswin32c.exe and they work fine.

But every time i call Process, i get an error Saying "An error occured when call to 'gsapi_init_with_args' is made: -100". Googling that error didn't bring anything up so I thought I might ask here.

Are there differnet arguments to consider when calling the .dll directly with Or did I made a mistake somewhere else?

Here's my class:

public class PdfConverter
#region Private Fields
private List _Versions = GhostscriptVersionInfo.GetInstalledVersions(GhostscriptLicense.GPL | GhostscriptLicense.AFPL | GhostscriptLicense.Artifex);

#region Private Properties
private GhostscriptVersionInfo Version { get; set; }

#region Construction
public PdfConverter()
Version = GhostscriptVersionInfo.GetLastInstalledVersion();

#region Public Members
public bool ConvertToPdf(DirectoryInfo dir)
var d = dir;
return false;

var postScriptFiles = d.GetFiles("*.ps");
var pdfFiles = postScriptFiles.Select(psf => new FileInfo(Path.ChangeExtension(psf.FullName, ".pdf")));

foreach(var file in postScriptFiles) {
//ThreadPool.QueueUserWorkItem(new WaitCallback((o) => {
Process(file, new FileInfo(Path.ChangeExtension(file.FullName, ".pdf")));

pdfFiles.ForEach(pdf => pdf?.Refresh());
return pdfFiles.All(pdf => pdf.Exists);

#region Private Helpers
private void Process(FileInfo inputFile, FileInfo outputFile)
Console.WriteLine($"Converting {inputFile} to {outputFile}");
var proc = new GhostscriptProcessor(Version, true);
proc.Process(GetArgs(inputFile, outputFile).ToArray(), new ConsoleStdIO(true, true, true));

private IEnumerable GetArgs(FileInfo inputFile, FileInfo outputFile)
return new [] {
$"-q ",
$"-c .setpdfwrite",
$"-f \"{inputFile.FullName}\""

Happy Hacking Mathew

Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered

This post first appeared on Stack Solved, please read the originial post: here

Share the post

SOLVED: gsapi_init_with_args is made: -100


Subscribe to Stack Solved

Get updates delivered right to your inbox!

Thank you for your subscription