ArtifexSoftware / Ghostscript.NET

Ghostscript.NET - managed wrapper around the Ghostscript library (32-bit & 64-bit)
https://ghostscript.com
GNU Affero General Public License v3.0
391 stars 152 forks source link

Issue: "An error occured when call to 'gsapi_init_with_args' is made: -100" when converting from PDF to TIFF using .Net Core 2.1 #74

Closed Luke-Meyer closed 3 years ago

Luke-Meyer commented 4 years ago
            switches.Add("-dNumRenderingThreads=4");
            switches.Add("-q");
            switches.Add("-dSAFER");
            switches.Add("-dBATCH");
            switches.Add("-dNOPAUSE");
            switches.Add("-sDEVICE=tiffg4");
            switches.Add("-sColorConversionStrategy=/LeaveColorUnchanged");
            switches.Add("-sOutputFile=" + convertedFilePath );
            switches.Add(@"-f");
            switches.Add(fileInfo.FullName);

This only happens intermittently.

bsebe commented 4 years ago

Maybe not related but I was getting that error code cause to a concurrent call to the library. That showed errors intermittently. Once I put it into a lock statement it worked like a charm. Hope it helps you.

Luke-Meyer commented 4 years ago

Maybe not related but I was getting that error code cause to a concurrent call to the library. That showed errors intermittently. Once I put it into a lock statement it worked like a charm. Hope it helps you.

Thanks for the advice! I will implement a lock on the ghostscript processor and see if that works. Given the low frequency of the issue, however, it may prove difficult to tell if the lock has solved the problem. If encountered again, I will post the news.

niwrA commented 3 years ago

When running from a unit test, I always get this same error. Any ideas?

bsebe commented 3 years ago

When running from a unit test, I always get this same error. Any ideas?

The only thing that came to my mind is if you are using the 64 bits dll and the unit test is running on a 32 bit scenario. I don't know, but using native dlls usually I always end fighting these kinds of things.

jhabjan commented 3 years ago

Can you please try to use latest version of Ghostscript.NET library (v.1.2.3 - released today) and latest version of Ghostscript native library (9.5.3) and see you still have this problem?