Hi. I am using Spire.PDF 7.5.7. I have about 700 PDFs and we want to do a check to make sure that all of the PDFs have the required number of pages. So I am using the code below to get the pageCount of each PDF to display it in our UI, but it is very slow. It took about 7 minutes to run. I tried using the same PdfDocument object for all files, but that only increased the performance to 5.5 minutes. Is there a better approach to get the page count for a large number of files?
foreach(var fileName in files)
{
int pageCount = -1;
...
using (PdfDocument document = new PdfDocument())
{
document.LoadFromFile(fileName);
pageCount = document.Pages.Count;
document.Close();
}
...
}