Ghostscript.Net error while opening stream

241 views Asked by At

I'm using Ghostscript.Net (v1.2.3) to create images from PDF in my .NETCore (v3.1) web application.

I'm trying to open the stream of the uploaded PDF file like this.

    for (int i = 0; i < request.Form.Files.Count; i++)
    {
        var file = request.Form.Files[i];

        using (var rasterizer = new Ghostscript.NET.Rasterizer.GhostscriptRasterizer())
        {
             rasterizer.Open(file.OpenReadStream());  //Error here
        }
    }

But I get an error on the Open() function: An error occured when call to 'gsapi_init_with_args' is made: -15

Having a closer look, -15 is a gs_error_rangecheck and in the ghostscript function here this error is said to be raised if: "Returns gs_error_rangecheck if out of bounds."

The stream seems to be correct, not empty...

Version of ghostscript installed is 9.52

Any idea what I'm doing wrong?

Thank you

0

There are 0 answers