开发者

GeckoFX WebBrowser page height and width

开发者 https://www.devze.com 2023-04-12 14:38 出处:网络
Does anyone know how I get the full page height and width in GeckoFX? In the IE WebBrowser object, I ca开发者_开发百科n look at WebBrowser.Document.Body.ScrollRectangle.

Does anyone know how I get the full page height and width in GeckoFX? In the IE WebBrowser object, I ca开发者_开发百科n look at WebBrowser.Document.Body.ScrollRectangle. (The objective here is to take a screenshot of the entire page)

Thanks!


I'm using Hindle's fork of GeckoFX, and here's how I do it:

var width = _browser.Document.ActiveElement.ScrollWidth;
var height = _browser.Document.ActiveElement.ScrollHeight;

I use this to create thumbnails of the page. Note, this gives us the size taken up by the first page we navigated to, not necessarily the size of the current page. I get around that by using different browser instances for each page I'm thumbnailing.


I did this:

BROWSER = new GeckoWebBrowser();
BROWSER.Height = 1920;
BROWSER.Width = 1080;

It seems working.


Visual Studio installed: Community 2019

GeckoFx installed: v45.0.34 (with NuGet package manager)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号