PdfViewer.OpenPdfFile causes system out of memory error

When I try to use PdfViewer.OpenPdfFile, it gives me a system out of memory error. I tried opening via a file path and a stream, and both have the same behavior. It brings the memory up to about a gig before it runs out.

I have an example app with the error, but I got an error trying to upload the file with this post.

Hi,

Thank you for considering Aspose.

If you are having problem in uploading your files, then send to us using any of the methods mentioned here:

Thanks.

Adeel Ahmad
Support Developer
Aspose Changsha Team
http://www.aspose.com/Wiki/default.aspx/Aspose.Corporate/ContactChangsha.html

Did you get the file?

Are you able to reproduce the error?

Thanks.

Hi,

I havent got it. Please resend it.

Thanks.

Adeel Ahmad
Support Developer
Aspose Changsha Team
http://www.aspose.com/Wiki/default.aspx/Aspose.Corporate/ContactChangsha.html

Hi,

I have tried with the document you send and was not able to reproduce the problem. Although the speed to load the Pdf file in the memory is slow as the size of the file is huge. Please make sure that whenever you call OpenPdfFile, you should explicitly close the opened file using ClosePdfFile() method to release all the memory.

Thanks.

Adeel Ahmad
Support Developer
Aspose Changsha Team

The size of the PDF being opened is under 7MB. When the viewer opens the file, it takes up over 750MB of memory. Is this normal? I’ve attached a screen shot.

Maybe there is a workaround for this also. I need to get the number of pages in an existing PDF, and print and existing PDF.

Thanks.

Hi,

I will discuss this issue that whether it is a normal behavior, but I think this is the only way to get the number of pages and print PDF documents. But note that the printing feature of Aspose.Pdf.Kit is not very stable. Some complexed pdf is not supported well. We are still working to improve this feature. You can also refer to :

Thanks.

Adeel Ahmad
Support Developer
Aspose Changsha Team
http://www.aspose.com/Wiki/default.aspx/Aspose.Corporate/ContactChangsha.html

Hi,

It 's abnormal, we are try to optimize the performance now, it may take a liitle more time about one or two months.

Best Regards.

Ok.

Is there any other way I can get the page count of an existing PDF doc?

Thanks.

Hi,

Yes its possible. Please try the following code:

PdfFileInfo fileInfo = new PdfFileInfo("D:/AsposeTest/Page/Test.pdf");
int noOfPages = fileInfo.NumberofPages;

Thanks.

Adeel Ahmad
Support Developer
Aspose Changsha Team
http://www.aspose.com/Wiki/default.aspx/Aspose.Corporate/ContactChangsha.html

Thanks. I’ll find another way to print the PDF for then.