Code Monkey home page Code Monkey logo

Comments (6)

pawelcodenest avatar pawelcodenest commented on July 19, 2024

Similar exception I got when I use a different constructor with loaded ghostscript lib into buffer:

if (Environment.Is64BitProcess)
{
    pathToGs = System.IO.Path.Combine(binPath, "gsdll64.dll");
}
else
{
    pathToGs = System.IO.Path.Combine(binPath, "gsdll32.dll");
}

List<string> switches = new List<string>
{
    "-empty",
    "-dSAFER",
    "-dBATCH",
    "-dNOPAUSE",
    "-dNOPROMPT",
    "-sDEVICE=pdfwrite",
    @"-sOutputFile=" + outputFilePath,
    @"-f",
    inputFilePath
};

using (GhostscriptProcessor ghostscript = new GhostscriptProcessor(File.ReadAllBytes(pathToGs)))
{
    ghostscript.Process(switches.ToArray());
}

from ghostscript.net.

PrimeJoker avatar PrimeJoker commented on July 19, 2024

I think the gsdll cannot be found, thats the main error message.
If you replace the path to the actual folder location of the gsdll, does it cause the same error message? Running IIS in production can be very fiddly. I would recommend placing the actual hard coded path to the gsdll. You might be surprised IIS is looking into the c:\windows folder instead of where your Web app is running from.

from ghostscript.net.

pawelcodenest avatar pawelcodenest commented on July 19, 2024

Yes, I copy dll's (both x64 and x32) to the bin application folder. Of course the same with GhostsctiptNet.dll
And of course I've installed native GhostsScript library in a server (both x64 and x32). The same effect.
I've tried to initialize GhostScriptProcessor in a different way, as I mentioned above, but its the same message.

But one thing: I use native gswin64.exe locally - no errors.
On a server it throws an exception message: dll cannot be loaded...
So maybe that is the reason, but why?

EDITED:
Can't load Ghostscript DLL
Can't load DLL, LoadLibrary error code 126

Seems, its a missing dependency error.

from ghostscript.net.

PrimeJoker avatar PrimeJoker commented on July 19, 2024

Try and retrace your steps. Reinstall ghostscript.net via nuget. You don't need to manually copy it to your webapp bin folder when you build it should do that automatically. You don't need gswin64.exe only the gsdll64.dll/gsdll32.dll and gsdll64.lib/gsdll32.lib.
Another question, is a 64/32 bit version installed? Check in IIS in application pools > Advanved settings. Under general section check if the enable 32-bit applications is enabled and disable it for your webapp. Remember to restart your webapp and app pool.

from ghostscript.net.

pawelcodenest avatar pawelcodenest commented on July 19, 2024

Resolved.
I installed GhostScript version 9.18 (64 bit). And no errors with running it locally, on a remote server and using GhostScript.NET.
I use a default constructor in code with default behavior.

List<string> switches = new List<string>
{
    "-empty",
    "-dSAFER",
    "-dBATCH",
    "-dNOPAUSE",
    "-dNOPROMPT",
    "-sDEVICE=pdfwrite",
    @"-sOutputFile=" + outputFilePath,
    @"-f",
    inputFilePath
};

using (GhostscriptProcessor ghostscript = new GhostscriptProcessor())
{
    ghostscript.Process(switches.ToArray());
}

from ghostscript.net.

pawelcodenest avatar pawelcodenest commented on July 19, 2024

Issue closed.

from ghostscript.net.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.