Hi,
//get 10 pdf file
string[] files = Directory.GetFiles(workFolder, “*.pdf”);
//case 1: sigle thread will take about 7s
foreach (var file in files)
{
AsposeToImage(file);
}
//case 2: multiple thread will take 9s
System.Threading.Tasks.
Parallel.ForEach<string>(files, new Action<string>(AsposeToImage));
//case 3: also 9s
files.ToList().ForEach(s =>
{
Thread t = new Thread(new ParameterizedThreadStart(AsposeToImage));
t.Start(s);
}
);
void
AsposeToImage(object file)
{
//Aspose.Pdf.Kit 5.3.0.0
PdfConverter pdfConverter = new PdfConverter();
pdfConverter.BindPdf(file.ToString());
pdfConverter.DoConvert();
pdfConverter.StartPage = 1;
pdfConverter.Resolution = 96;
if (pdfConverter.HasNextImage())
{
pdfConverter.GetNextImage(workFolder +
Path.GetFileNameWithoutExtension(file.ToString()) + ".png");
}
pdfConverter.Close();
}
Thank you for your reply. please review my code and where is the problem?
Hi,
have tested the scenario and I am able to reproduce the same performance related issue while using the product in multi-threaded environment. For the
sake of correction, I have logged it in our issue tracking system as PDFNEWNET-35764. We
will investigate this issue in details and will keep you updated on the status
of a correction.
We apologize for your inconvenience.