How to reference Ghostscript DLL in C#
<p>I'm using a C# wrapper to convert PDFs to images using Ghostscript, however i cant seem to reference the dll correctly.
I have the DLL stored in the bin folder (also don't know if that's the best place to keep it there or not)
Here's my code:</p>

<pre><code> byte[] fileData = null;
            using (var binaryReader = new BinaryReader(Request.Files[0].InputStream))
            {
                fileData = binaryReader.ReadBytes(Request.Files[0].ContentLength);
            }

    string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase);

    Ghostscript.NET.Rasterizer.GhostscriptRasterizer rasterizer = null;
    Ghostscript.NET.GhostscriptVersionInfo vesion = new Ghostscript.NET.GhostscriptVersionInfo(new Version(0, 0, 0), path + @"\gsdll64.dll", string.Empty, Ghostscript.NET.GhostscriptLicense.GPL);
    Stream inStream = new MemoryStream(fileData);
    MemoryStream outStream = new MemoryStream();
    List&lt;Image&gt; imageList = new List&lt;Image&gt;();
    using (rasterizer = new Ghostscript.NET.Rasterizer.GhostscriptRasterizer())
    {
        rasterizer.Open(inStream, vesion, false);
         for (int i = 1; i &lt;= rasterizer.PageCount; i++)
        {
            //string pageFilePath = Path.Combine(outputPath, Path.GetFileNameWithoutExtension(file) + "-p" + i.ToString() + ".jpg");
            int dpi = 200;
            Image img = rasterizer.GetPage(dpi, dpi, i);
            img.Save(outStream, ImageFormat.Jpeg);
            Image img = new Image
            {
                imgByteArray = outStream.ToArray()
            };
            imageList.Add(image);
        }
         rasterizer.Close();
    }
</code></pre>

<p>I'm getting the <strong>Ghostscript native library could not be found</strong> error.
Here's the path I get </p>

<p><a href="https://i.stack.imgur.com/qe3QA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qe3QA.png" alt="enter image description here"></a></p>

<p>I think it has to do with the double / and 'file://' in the DLLPath string. And should I also specify the LipPath as well?
Any help??</p>