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

.Net 4.61: An error occured when call to gsapi_new_instance is made: -100 #85

Closed joro01 closed 3 years ago

joro01 commented 3 years ago

Hi, I've tried to convert a PDF to an image and get the following error: Ghostscript.NET.GhostscriptAPICallException: 'An error occured when call to 'gsapi_new_instance' is made: -100'

I've used you sample code for my implementation. I have not installed Ghostscript on my Computer, I add the gsdll64.dll manually. The Application is a 64bit application, so the assembly 'gs64dll.dll' must be correct .

Can you please help me? Do I have to init an Interpreter first or something like that?

image

jhabjan commented 3 years ago

I just tried that and I can't reproduce the problem. Can you try to run your Visual Studio as Administrator and then try it again?

ss-jj-41

micke911 commented 3 years ago

Hi! I'm experiencing the same issue trying to open the rasterizer in a 32 bit .net MVC application. I have installed the Ghostscript.net 1.2.2 package, installed Ghostscript 9.53.3 and copied the gsdll32.dll file to the bin folder. Running Visual Studio 2019 as Administrator.


                {
                    var dllPath = @"C:\Website\bin\gsdll32.dll";
                    rasterizer.Open(physicalFilePath, new GhostscriptVersionInfo(dllPath), false);
                    var image = rasterizer.GetPage(96, pageNumber);
                 }

UPDATE:
Got it working by downgrading Ghostscript to 9.26.
rburgstaler commented 3 years ago

I just tried that and I can't reproduce the problem. Can you try to run your Visual Studio as Administrator and then try it again?

ss-jj-41

I was having the same issue. Running VS as Administrator did not resolve the issue. I did try as @micke911 suggested by downgrading to 9.26 and it did resolve my issue as well.. @jhabjan what version were you testing in? I was getting this error with 9.53.3 32 bit version of GhostScript.

jhabjan commented 3 years ago

I just found and fixed this problem earlier today. The changes will be push shortly and I'll publish new dll.

jhabjan commented 3 years ago

v.1.2.3 that fixes this problem is now rolled out on Github and NuGet. Give it a go and please let me know if this is sorted out now.

joro01 commented 3 years ago

Hi, I am afraid but it still doesn't work. Even if I start my VS as admin, it does not work. I do not have Ghostscript installed on my machine. I just use the assembly . Can this be a problem?

jhabjan commented 3 years ago

@joro01 , just to be clear, you tried Ghostscript.NET v.1.2.3 together with Ghostscript 9.53.3?

micke911 commented 3 years ago

Tried Ghostscript.NET v.1.2.3 with Ghostscript 9.53.3 and the exception is not thrown. Problem solved for me!

jhabjan commented 3 years ago

I'm glad this resolved your issue @micke911