Best approach to create PDF -> PNG thumbnails on an Azure Web Site?

Apr 9, 2014 at 2:59 PM
I was thinking about using Magick.NET to create PNG thumbnails of PDFs that are uploaded to a website. However, the website is hosted on Azure Web Sites and therefore I cannot install Ghostscript on the machine. Is there any way to use Magick.NET to do this without having to install Ghostscript?
Coordinator
Apr 9, 2014 at 3:27 PM
It should be possible to use Ghostscript without installing it. You should first download and install Ghostscript on your own machine. If you want to use the x64 version of Magick.NET you should install the x64 version of Ghostscript. You need to install it because you need to copy the file gsdll64.dll or gsdll32.dll to your project/website. I have not tested this so you might have to copy the dll into your bin directory before it works. You could try to place it somewhere else first. Before you use Magick.NET in your website make sure you do the following call:
MagickNET.SetGhostscriptDirectory(@"c:\directory\where\you\put\the\dll\of\ghostscript");
Apr 9, 2014 at 3:32 PM
Awesome! I'll give it a try. Thanks.
Jun 13, 2014 at 6:34 AM
Has anyone has any success deploying Magick.Net and Ghostscript to an Azure site?
Coordinator
Jun 13, 2014 at 7:13 AM
Have you tried my solution?
Jun 13, 2014 at 11:37 AM
We have some other issues to address before we can make the switch to Azure, so we've implemented the above solution locally but we haven't actually tested it on Azure yet.
Jul 3, 2014 at 9:10 AM
Edited Jul 3, 2014 at 9:20 AM
dlemstra wrote:
Have you tried my solution?
Hi,

FYI: I've tried your solution and it works on azure websites.

In Startup.cs I set the path like this:
   var path = HttpContext.Current.Server.MapPath("~/bin");
   MagickNET.SetGhostscriptDirectory(path);
Coordinator
Jul 3, 2014 at 10:01 AM
I am happy to hear you got it working. I will add a patch to MagickNET before the next release that will allow you to do this:
MagickNET.SetGhostscriptDirectory("~/bin");
This already works for reading a MagickImage:
using (MagickImage image = new MagickImage("~/files/img.jpg"))
{
   // Do something with your image.
}
May 4, 2015 at 11:56 AM
dlemstra wrote:
It should be possible to use Ghostscript without installing it. You should first download and install Ghostscript on your own machine. If you want to use the x64 version of Magick.NET you should install the x64 version of Ghostscript. You need to install it because you need to copy the file gsdll64.dll or gsdll32.dll to your project/website. I have not tested this so you might have to copy the dll into your bin directory before it works. You could try to place it somewhere else first. Before you use Magick.NET in your website make sure you do the following call:
MagickNET.SetGhostscriptDirectory(@"c:\directory\where\you\put\the\dll\of\ghostscript");
Awesome, thanks a lot!