newhouse-pt
newhouse-pt

Reputation: 141

Ghostscript installation issue on .net

I followed a ton of SO guides in order to install Ghostscript in my MVC C# app but I cannot make the code below be recognized. It keeps saying "GhostscriptRasterizer could not be found (are you missing a using directive or an assembly reference?)"

public ActionResult PDFToImages(string pdfFilePath)
        {
            //...

            using (var rasterizer = new GhostscriptRasterizer())
            {
                //...
            }

            //...
        }

I am using Visual Studio and here's what I've already tried:

Upvotes: 0

Views: 2631

Answers (1)

Dave Miller
Dave Miller

Reputation: 542

If your objective is to make uso of Ghostscript .NET directly, you would not need to reference the original Ghostscript DLL from your project (as I said, until you desire to do so).

I tested Ghostscript .NET over Windows 7 and windows 10, with Visual Studio Community 2017 simply following these steps:

  1. Install Ghostscript 9.52 for Windows (32 bits).

  2. Using Nuget package manager, added Ghostscript .NET to my solution.

  3. Include using code lines, as required (main namespace and Rasterizer for your case should work, I use Processor, in addition):

    using Ghostscript.NET;
    using Ghostscript.NET.Processor;
    using Ghostscript.NET.Rasterizer;

I have checked in a new Console Application project the using clause (which makes use of Rasterizer class) that you have provided, and does not return any error, if I perform these steps previously.

Please, try again repeating the actions mentioned, and let me know if you manage to use Ghostscript that way.

Upvotes: 1

Related Questions