Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GhostScript in Azure

I'm in the process of moving some on-premise app to Azure and struggling with once aspect - GhostScript. We use GhostScript to convert PDF's to multi page TIFF's. At present this is deployed in an Azure VM, but it seems like a WebApp and WebJob would be a better fit - from a management point of view. In all of my testing I've been unable to get a job to run the GhostScript exe.

Has anyone been able to run GhostScript or any third party exe in a WebJob?

I have tried packaging the GhostScript exe, lib and dll into a ZIP file and then unzip to Path.GetTempPath() and then using a new System.Diagnostics.Process to run the exe with the required parameters - this didn't work - the process refused to start with an exit code of -1073741819.

Any help or suggestions would be appreciated.

like image 922
markpirvine Avatar asked Apr 06 '15 12:04

markpirvine


1 Answers

We got it to work here: Converting PDFs to Multipage Tiff files Using Azure WebJobs. The key was putting the Ghostscript assemblies in the root of the project and setting "Copy always". This is what allows them to be pushed to the Azure server, and to end up in the correct place, when you publish the project.

Also, we needed to download the file to be processed by Ghostscript to the local Azure WebJob temp directory. This is discovered by using the following code:

Environment.GetEnvironmentVariable("WEBJOBS_PATH");
like image 70
Michael Washington Avatar answered Oct 21 '22 02:10

Michael Washington