0

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

Philiz
  • 429
  • 5
  • 25
  • Almost certainly the problem is the PDF file, which has something wrong with it. I very much doubt the problem is with the function you are pointing at. Without seeing the PDF file I can't comment further. Note that Ghostscript.NET is not provided by Artifex, it is not part of Ghostscript, it is a separate wrapper. – KenS Feb 02 '22 at 17:16
  • I just gave a try with Magick.net, it's working with it. The pdf seems not to be the problem. (And I also tried with other pdf as well) – Philiz Feb 02 '22 at 20:53
  • Doesn't mean the PDF file is not at fault. If you are convinced the problem is Ghostscript.NET then you should remove the Ghostscript tag. – KenS Feb 03 '22 at 08:02

0 Answers0