We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to use Aspose.Words in multithreading

What did you find to be the best solution for this?

What was the best solution for this?


You can use Parallel.ForEach loop as shown below for multithreading. Hope this helps you.

string testFilesDirectory = Directory.GetCurrentDirectory() + "\\Test_Files";
string[] files = Directory.GetFiles(testFilesDirectory);

    Parallel.ForEach(files, file =>
        Aspose.Words.LoadOptions options = new Aspose.Words.LoadOptions();
        options.LoadFormat = LoadFormat.Mhtml;
        Document doc = new Document(file, options);
        Console.WriteLine("Successfully opened " + file);
        doc.Save(file + ".pdf");

catch (Exception ex)