Hi,
First - thanks for the great library, it works very well on my win7 machine. I use it to convert PDFs to images, and the load from memory feature is particularly handy as it enables me to thread my application.
I've been trying to deploy this code onto a Windows Server 2012 R2 machine, but have been running into a problem when trying to load the GS library from memory.
To test - I've built the provided 'Ghostscript.NET.Samples' targeting x64 and .NET 4.5. The only thing that I changed in the whole project is the input/output path, and this line:
_rasterizer.Open(inputPdfPath, _lastInstalledVersion, true);
The built application works fine on a windows 7 x64 machine, with .NET 4.5 installed, but fails on a Server 2012 R2 x64 machine with the following stack trace:
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at Ghostscript.NET.Interpreter.GhostscriptInterpreter.Initialize() in c:\dev\Ghostscript.NET.v.1.1.2\Ghostscript.NET\Interpreter\GhostscriptInterpreter.cs:li
ne 152
at Ghostscript.NET.Interpreter.GhostscriptInterpreter..ctor(GhostscriptVersionInfo version, Boolean fromMemory) in c:\dev\Ghostscript.NET.v.1.1.2\Ghostscript
.NET\Interpreter\GhostscriptInterpreter.cs:line 94
at Ghostscript.NET.Viewer.GhostscriptViewer.Open(String path, GhostscriptVersionInfo versionInfo, Boolean dllFromMemory) in c:\dev\Ghostscript.NET.v.1.1.2\Ghostscript.NET\Viewer\GhostscriptViewer.cs:line 282
at Ghostscript.NET.Rasterizer.GhostscriptRasterizer.Open(String path, GhostscriptVersionInfo versionInfo, Boolean dllFromMemory) in c:\dev\Ghostscript.NET.v.1.1.2\Ghostscript.NET\Rasterizer\GhostscriptRasterizer.cs:line 192
at Ghostscript.NET.Samples.RasterizerSample.Start() in c:\dev\Ghostscript.NET.v.1.1.2\Ghostscript.NET.Samples\Samples\RasterizerSample.cs:line 67
at Ghostscript.NET.Samples.Program.Main(String[] args) in c:\dev\Ghostscript.NET.v.1.1.2\Ghostscript.NET.Samples\Program.cs:line 55
If I change the above line to:
_rasterizer.Open(inputPdfPath, _lastInstalledVersion, false);
then everything works without any problems. However, then I can't thread the application.
I saw
here that there might be an issue with .NET 4.5?
Any suggestions for a solution/workaround would be greatly appreciated.
I'm using ghostscript 9.10 and have tried the above with both versions 1.1.1 and 1.1.2 of Ghostscript.NET.
Many thanks,
Antony