Welcome Guest Search | Active Topics | Sign In | Register

WebView.Capture can return null, can we know why? Options
Panda
Posted: Monday, October 26, 2015 1:46:21 AM
Rank: Advanced Member
Groups: Member

Joined: 10/7/2015
Posts: 35
Hi,

I'm taking screenshots using the WebView.Capture() method - http://www.essentialobjects.com/doc/eo.webbrowser.webview.capture_overload_2.aspx

But for some large rectangles, it returns null, instead of an Image.
I'm guessing this means "out of memory" while trying to allocate large chunks (just based on previous experience with Gecko Browser actually)...
But the documentation doesn't say anything about it.
Are you able to confirm what it means when Capture() returns null and if anything can be done about it - other than making the rectangle smaller?
eo_support
Posted: Monday, October 26, 2015 6:47:31 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Hi,

It's possible that Capture returns null. Capture works by making copy from the display frame buffer. If your rect is too big and is considered invalid by the underlying screen buffer, then it will return null. So yes, you will need to make rectangle smaller in that case.

Thanks!
Panda
Posted: Tuesday, October 27, 2015 3:29:19 AM
Rank: Advanced Member
Groups: Member

Joined: 10/7/2015
Posts: 35
Thanks,

It's a slightly difficult situation for us, because the rectangle I'm speaking of is selected by the user, to "screenshot" that portion of the screen.
We are finding that once the rectangle is around 1000px wide, Capture() fails and we can't provide the functionality that we need.

I'm not really sure what you mean when the rectangle is considered "invalid"... I can only ask why is it invalid?
Is it a limitation of the .NET wrapper or of the Chrome browser itself?

Perhaps it's difficult for you to reveal too much (I suspect there must be some GDI/bitmap and/or 32-bit memory allocation issues behind the scenes)

This issue seems very limiting without a very good reason, at this stage.
eo_support
Posted: Tuesday, October 27, 2015 8:45:06 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Hi,

It's a limitation of the Chrome browser engine and the way capture is implemented. Capture does not render the page, it gets whatever that's already rendered in the screen buffer. Obviously for performance reason the screen buffer will not hold contents much bigger than the actual screen and we have no control over that (it's managed by the GPU). Sometimes it does hold more than what's needed on screen so that user can scroll faster. So the primary purpose of capture is to capture what's user already seeing on the screen. If you use it for other purpose, then you would using it beyond it's designed capacity.

In the future we might add a Render method that would allow you to render any portion of page into an image. That will probably be a more suitable feature for your purpose.

Thanks!


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.