简体   繁体   中英

Using Ghostscript.Net on an ASP.NET Azure Website

I am using Ghostscript.NET in order to convert a PDF page into a jpg. This all works fine when I run it locally, but when I publish it to an Azure website then I get the error:

" This managed library is running under 32-bit process and requires 32-bit Ghostscript native library installation on this machine! To download proper Ghostscript native library please visit: http://www.ghostscript.com/download/gsdnld.html "

Obviously I can't just install Ghostscript on the server that the Azure Website is running on, I don't have access to do that. Is there any way that I can include a Ghostscript library in the publishing profile, and have Ghostscript.NET read from that?

Alternatively, is there any package that would allow me to convert a PDF page to a jpg thumbnail on an ASP.NET server without using Ghostscript at all? I have also tried GhostScriptSharp and had no luck with that either.

You could try to install native ghostscript library to your local machine and get gsdll32.dll (or gsdll64.dll if you are running in x64 bit environment) which you can deploy to your server along with the other dlls.

Take a look at this example how to tell Ghostscript.NET where to search for the native ghostscript library dll: https://github.com/jhabjan/Ghostscript.NET/blob/master/Ghostscript.NET.Samples/Samples/CustomGsdllLocationSample.cs

You have a few options.

  1. Host your website as an Azure Cloud Service Web Role. This allows you to react to the server being created and you can run installation programs (if you can automate them) to prep the machine.

  2. Split this functionality out into an Azure Cloud Service Worker Role (where you can do the same machine prep) and have it respond to an Azure Queue item. This way your website remains pretty much as is.

Be careful though, Cloud Services can get expensive if they are just sitting there doing nothing because its still running on a VM. You can have your Cloud Service scale based on the queue having items or not.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM