Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Out of Memory exception when scrolling large PDFs #7

Open
lukamicoder opened this issue May 20, 2015 · 2 comments
Open

Out of Memory exception when scrolling large PDFs #7

lukamicoder opened this issue May 20, 2015 · 2 comments

Comments

@lukamicoder
Copy link
Contributor

If you open a large and long (>250 pages) PDF, maximize the window, set zoom to fit width, grab the scroll bar and start to pull it down, not too slow nor too fast, you will get this error: "An unhandled exception of type 'System.OutOfMemoryException' occurred in PresentationCore.dll" at line 36 of BitmapExtensionMethods.cs.

@kerektamas
Copy link

kerektamas commented Jul 4, 2016

I have same problem.

When I open a large and long (>250 pages) PDF, maximize the window, set zoom to fit width or bigger, grab the scroll bar and start to pull it down, not too slow nor too fast, I will get this error: "An unhandled exception of type 'System.OutOfMemoryException' occurred in PresentationCore.dll" at line 36 of BitmapExtensionMethods.cs (constructor of WriteableBitmap class).
When the application is running, the memory usage extremely increase.

I put these lines after "var img = new PdfImage { ImageSource = bms, Margin = margin };" in PdfImageProvider.cs in your source, but not worked:

bms = null;
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();

I use the library in .Net 4.5, Windows 8 (x86!) with 4GB memory.

Can You help me, please?

Thanks

@NaughtyCatRun
Copy link

NaughtyCatRun commented May 11, 2017

Hi, guys. You can set MaxZoomFactor property of MoonPdfPanel based on your situation. For example, set 2.8 to MaxZoomFactor is OK when I using one file contains 906 pages while setting 3.0 to MaxZoomFactor will out of memory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants