FailedToExecuteCommand ghostscript gswin64c.exe on azure

Viewed 1426

I am trying to convert pdf into images using magickNET and ghostscript. It works well on local and windows VMS servers. But when i push to azure servers it gives me the error saying FailedToExecuteCommand ghostscript gswin64c.exe. Details of error in attachements.

I tried changing the path for ghostscript dll but found no luck. The path is correct and dll file is there. One thing I am sure of. I have put dll inside wwwroot/GhostScriptDll. on error it shows "D:/home/site/wwwroot/wwwroot/GhostScriptDll/gswin64c.exe" which is also correct there are 2's wwwroot. can someone help me to use ghostscript without webjobs things.

C# code i tried is like this

enter image description here

 string rawpath = _hostingEnvironment.WebRootPath + "\\GhostScriptDll"
            MagickNET.SetGhostscriptDirectory(rawpath);
            MagickReadSettings settings = new MagickReadSettings();
            settings.Density = new Density(300, 300);
            List<string> intList = new List<string>() { };
            using (MagickImageCollection images = new MagickImageCollection())
            {
                images.Read($"{rawFileLocation}{model.OriginalDocName}", settings);
                int page = 1;
                string tempName = "";
                foreach (MagickImage image in images)
                {
                    tempName = System.IO.Path.GetRandomFileName().Replace(".", string.Empty) + "_processed_" + page + ".png";
                    image.Write($"{processedFileLocation}{tempName}");
                    intList.Add(tempName);
                    page++;
                }
            }

i doubt in this part of error D:/local/Temp/magick-MB0cs71xMgZUfIHIwbzlzehBIlLL-NED"' (The system cannot find the file specified. ) @ error/delegate.c/ExternalDelegateCommand/475 ...i dont find the local/temp/.. folder in server though

0 Answers
Related