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

Free Support Forum - aspose.com

Slow rendering PDF for large size pdf file

For some reason, the attached PDF file takes a really long time to render in my program use Apose.PDF.dll. It is a little large for a PDF - 59MB but only 18 pages. It is rendered quickly in Edge, Chrome and Firefox but on my fastest machine (AMD Ryzen 7 3800X 8-core, 3.90Ghz with 32GB RAM) it takes 48 seconds before the first page is rendered and 3.5 minutes to render the rest of the thumbnails. On a slower machine (Intel Core Duo, 3Ghz, and 8GB RAM), it took 2.5 minutes for to render the first page and I gave up on the rest of the thumbnails after 10 minutes. Here attach pdf file link
https://1drv.ms/b/s!AtES_rSduI-rgYFhHZDye8wSa79l7A?e=m6kecY

@Glority_Developer

By rendering, do you mean loading the document? Can you please clarify by sharing a sample code snippet for our reference? We will further proceed to assist you accordingly.

Is not loaded. Loading the PDF file into memory didn’t take much time but getting some PDF single-page objects in Apose.PDF.PageCollection can take a lot of time.
Here is the relevant code:
//////////////////////////////////////////////////////////////////////////////////////////////////////////
var fileIcon = new FileIcon();
var imageSource = fileIcon.GetImage(pdfFileInfo.filePath, 1024);
foreach (Apose.PDF.Page page in pages)
{
string pageNumber = (Icon.IconSources.Count + 1).ToString();
var width = 200;
var height = 300;
var iconItem = new IconItem(page, width, height, cancellationToken);
iconItem.UpdateThumbnailEvent += IconItem_UpdateThumbnailEvent;
iconItem.SetIcon(imageSource);
iconItem.SetName(pageNumber);

            Dispatcher.Invoke(DispatcherPriority.Send, new Action(() =>
            {
                Icon.IconSources.Add(iconItem);
            }));
        } 

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
In the code above, “pages” is Apose.PDF.PageCollection,. “foreach (var page in pages)” will take a lot of time When getting certain pages. However ,It is rendered quickly in Edge.

@Glority_Developer

We tested the scenario in our environment using 22.9 version of the API but we could not notice any issues. Are you facing a delay while iterating through every page? OR is there a specific page that is taking time at your end? Could you please share a sample console application for our reference so that we can try to replicate it in our environment and address it accordingly?

Yes, a lot of time was spent on the first page. Here attach a link about a sample console application and code. It seems that “page.ConvertToPNGMemoryStream()” take a lot of time.
https://1drv.ms/u/s!AtES_rSduI-rgYFnFwth4gQAu35FtA?e=gi1hMi

@Glority_Developer

We were able to replicate the issue in our environment and have logged it as PDFNET-52616 in our issue tracking system. We will further look into its details and keep you posted with the status of its rectification. Please be patient and spare us some time.

We are sorry for the inconvenience.