Open methoed of GhostscriptRasterizer failes

Feb 16, 2015 at 6:44 AM
Edited Feb 16, 2015 at 8:44 AM
I been looking to try this library with

I have this code:
        Dim s As String = "C:\Users\AlbertKallal\Desktop\Deskhold\2013_salaryreport.pdf"

        Dim gVER As GhostscriptVersionInfo
        gVER = GhostscriptVersionInfo.GetLastInstalledVersion(GhostscriptLicense.GPL, GhostscriptLicense.GPL)

        Dim gPDF As New GhostscriptRasterizer
I keep getting this exception:

An error occurred when call to 'gsapi_init_with_args' is made: -15"

I also tried this for the open method:

gPDF.Open(s, gVER, False)

I installed this via NuGet into vs2013 (Ghostscript.NET.1.2.0).

I tried setting the project framework to 4.5, 4, and also set target CPU to x86. (none of these changes made any difference)

Any tips or suggestions to get the above code to run?
My first goal would be to simply obtain the number of pages in the pdf file. (gPDF.PageCount), but I cannot get past the “open” command. Do I need to set any of the custom switches before attempting the open method?

edit: adding this:
output: 8.15
It now works. The fix was to install ghostscript again, and THEN force the project to x64.__

Hope the above helps anyone receiving the above message.

I consider this "resolved".

Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
Feb 18, 2015 at 4:53 AM
Hi Albert,

Sorry for a late response.

Error -15 means "rangecheck" error. But since you used Ghostscript 8.15 (which is a bit old version) it's not surprising as Ghostscript.NET is tested with native Ghostscript library 9.0 and on.

If you want to use Ghostscript.NET in both x86 and x64 environments and your projecct target CPU is 'Any', you need to install both native Ghostscript libraries:

x86; gs915w32 ->
x64: gs915w64->