carlbenson
carlbenson

Reputation: 3207

GeckoFX WebBrowser page height and width

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

Thanks!

Upvotes: 2

Views: 2134

Answers (2)

Giuse Petroso
Giuse Petroso

Reputation: 647

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)

Upvotes: 0

John Hatton
John Hatton

Reputation: 1784

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.

Upvotes: 2

Related Questions