logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
TannerStevenson  
#1 Posted : Friday, March 10, 2017 12:38:22 PM(UTC)
TannerStevenson

Rank: Member

Groups: Registered
Joined: 3/10/2017(UTC)
Posts: 12

Thanks: 1 times
Hi,

I am using the PdfViewer in a custom control that allows users to resize the pdfViewer with a GridSplitter. I am finding that when a user resizes too much too quickly, the memory usage skyrockets and I end up getting a OutOfMemoryException:

System.OutOfMemoryException: Insufficient memory to continue the execution of the program.
at System.Windows.Media.Imaging.WriteableBitmap..ctor(Int32 pixelWidth, Int32 pixelHeight, Double dpiX, Double dpiY, PixelFormat pixelFormat, BitmapPalette palette)
at Patagames.Pdf.Net.Controls.Wpf.PdfViewer.DrawCanvasToContext(DrawingContext drawingContext, Int32 cw, Int32 ch, Boolean allPagesAreRendered)
at Patagames.Pdf.Net.Controls.Wpf.PdfViewer.OnRender(DrawingContext drawingContext)
at System.Windows.UIElement.Arrange(Rect finalRect)
at System.Windows.ContextLayoutManager.UpdateLayout()
at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

Is this simply a limitation of the PdfViewer? Or is there something I can do on my end to limit the amount of memory used when the PdfViewer resizes?
I am using version 3.2.3.0 of the Pdfium.NET SDK.
Paul Rayman  
#2 Posted : Tuesday, March 14, 2017 3:26:33 AM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 1,138

Thanks: 10 times
Was thanked: 133 time(s) in 130 post(s)
Please upgrade to the latest version (Currently 3.7.4.2704).
We have fixed some issues like that at version 3.6.3.2704
http://forum.patagames.c...released-on-Nov-13--2016

Also you can try to compile your app in x64 environment.
thanks 1 user thanked Paul Rayman for this useful post.
TannerStevenson on 3/15/2017(UTC)
TannerStevenson  
#3 Posted : Wednesday, March 15, 2017 1:48:52 PM(UTC)
TannerStevenson

Rank: Member

Groups: Registered
Joined: 3/10/2017(UTC)
Posts: 12

Thanks: 1 times
Hi Paul,

Thank you for the direction. So I downloaded the the latest version, yet I am still getting the out of memory exception if I resize too rapidly.

I did notice I needed to use the x32 pdfium.dll instead of the x64 one. The x64 one couldn't be found when Initialize was called but the x32 one could. I would guess because of the license key? But I'm not sure if this would have any effect seeing as the error seems directly related to the PdfViewer.

I also noticed that the Patagames.Pdf.Wpf.dll was version 3.5.5.0, not 3.7.4.2704 as the rest of the libraries which also surprised me a little.
Paul Rayman  
#4 Posted : Wednesday, March 15, 2017 2:56:46 PM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 1,138

Thanks: 10 times
Was thanked: 133 time(s) in 130 post(s)
we will try to fix it in the next release.
Thanks.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.