Free Support Forum - aspose.com

doc.PageCount gives performance problem when processing large document

Hi,

After rendering my document (approx 6000 pages) I need to store the number of pages. Therfore I use the doc.PageCount method. However this line of code kills my CPU and eats a lot of memory.

I've aborted this function after 15 minutes.

Any help on this issue is highly apriciated.

Ron van Leeuwen

I have the same issue!


We have a 400 page batch of financial statement documents (sent to printer as a batch rather than individually or there would be thousands of jobs in the print queue) - I had to comment out the line in my code because it was killing my processing time.


Aspose - Is there some simplistic pre-rendering the component could do when a document is loaded to calculate this?


Thanks
Jon

Hi,


Thanks for your inquiry. Document.PageCount property invokes ‘page layout process’ which builds and formats the document into pages in memory; so, please note that with large documents this property can take time. After invoking this property, any rendering operation e.g rendering to PDF or image will be instantaneous.

Best Regards,