I am currently trying to write a process that takes thousands of small word documents and turn them into PDF. Because speed is something I am concerned about I am trying to thread the process. Right now I have 3 threads running that do a document merge in a word document and then save that word document to a disk. Consistently I have been getting the following error.
Exception thrown: 'System.InvalidOperationException' in System.Drawing.dll ("Object is currently in use elsewhere.")
I get this error whether using .NET or WPF object. The error happens on the following piece of code:
document.SaveToFile(@"c:\FolderName\pdf\documentName_" + IncrementedNumber + "_1.pdf", Spire.Doc.FileFormat.PDF);
I am using the .NET Task object to assign the tasks out.
I currently own the .NET version of the office controls but I have noticed that the WPF version seems to be quicker. I would be willing to buy those controls also if this can be fixed otherwise I have to look for a different solution. I like these controls because I don't want to have to install office on any of our servers which many other controls require. Could you please help me find a way to make this work. Limiting the pdf conversion to one thread does not help me since this is the longest part of my process and one of my main requirements is speed.
Thank you,
Eric Cooperider