I am using the Ghostscript in my C# dot.net core 6 azure function to convert pdf documents into png images, which works well in the local environment. However, when I tried to deploy it to Azure from my VS Code and test it, spotted that pdfs are not converted into png images. Looking into logs, I see the following error:
An error occurred during PDF to PNG conversion: An error occurred trying to start process './ghostscript/10.01.2/bin/gs' with working directory '/'. No such file or directory
Here is the relevant part of the code:
var ghostscriptArgs = $"-q -dQUIET -dBATCH -dNOPAUSE -sDEVICE=pngalpha -r150 -sOutputFile=\"{tempDirectory}/output-%03d.png\" \"{tempFilePath}\"";
var ghostscriptProcessInfo = new ProcessStartInfo
{
FileName = "./ghostscript/10.01.2/bin/gs",
Arguments = ghostscriptArgs,
RedirectStandardOutput = true,
RedirectStandardError = true,
UseShellExecute = false,
CreateNoWindow = true
};
Here is the folder with ghostscript, placed in the project root:
Any idea where I am making a mistake? Thanks.