While we appreciate comments from our users, please follow our posting guidelines. Have you tried the Cyotek Forums for support from Cyotek and the community?

Styling with Markdown is supported

Original Comment

Gravatar

kranthi

# Reply

Hi Team,

Currently I am using GhostScript dll in one of my services to convert pdf to images. GhostScriptAPI Execute method is called to convert pages of pdf into images. I am facing an issue when trying to convert multiple pdf files simultaneously using thread, but GhostScriptAPI cannot able to process in parallel. Can you please let me know any way so, I can use GhostScriptAPI dll in parallel.

using (GhostScriptAPI api = new GhostScriptAPI()) { api.Execute(this.GetConversionArguments(this.pdfFileName, outputFileName, pageNumber, this.PdfPassword, this.Settings)); } Issue occurs when two threads pdf's are processed at same time.

Gravatar

Richard Moss

# Reply

I had a quick glance at the GhostScriptAPI class to refresh my memory, it has been some time since I looked at it. As far as I can see, it is self contained so should work in parallel. If it doesn't, then it is most likely because the native Ghostscript DLL doesn't support this. And in fact a 30 second check of the documentation finds

At this stage, Ghostscript supports only one instance.

You could try creating a single instance of the GhostScriptAPI class and then using that in your parallel loop, as I'm assuming right now you're creating one instance per thread. However, I suspect this won't work either the arguments are bound to that single instance ID. You might be better off asking the authors of Ghostscript themselves about parallel support.

Sorry I can't be of more help.

Regards;
Richard Moss