Thanks for contacting support and sorry for the delay in response.
It seems that the issue might be related with the implementation of the multi-threaded routine, as while execution of such routine, it is a bit difficult to determine the root cause of the error. There is quite a chance that upcoming thread accesses the existing object of the document in the memory with new password value, which is why the API throws such error.
Furthermore, you may try to instantiate a new instance of your class in each thread which will avoid cross-threaded situations.
Aspose.Words API does support multi-threading and the only thing, you need to take care of is, only one thread should access Document Object in one time. For example, you may write a method in which a new instance of the Document is initialized and output is being saved in a global
List<T> object, which can be accessed after the end of execution, to get all output streams/files.
Please check following code snippet where I have implemented a very basic and simple implementation of single thread for the document conversion.
System.Threading.ManualResetEvent FirstTier = new System.Threading.ManualResetEvent(false);
var th = new System.Threading.Thread(() =>
// Load the document from disk.
Document doc = new Document(dataDir + "Template.doc");
dataDir = dataDir + "Template_out.pdf";
// Save the document in PDF format.
You may implement threading scheme as per your requirements, by following shared guidelines, and in case if you experience any issue, please feel free to let us know.