Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.

Full page screenshot with Page.captureScreenshot

Post Reply
Rui
Posts: 2
Joined: Wed Apr 20, 2022 4:05 pm

Full page screenshot with Page.captureScreenshot

Post by Rui »

Hi,

Is there a way of doing a full page screenshot with Page.captureScreenshot ?

Thanks
User avatar
salvadordf
Posts: 4057
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Full page screenshot with Page.captureScreenshot

Post by salvadordf »

Hi,

Several demos show how to take snapshots of a web page but they only include what's visible on the browser at that moment. See the MiniBrowser or the WebpageSnapshot demos.

It's not easy to capture the whole page because some pages have infinite scroll, some have absolutely positioned elements, etc.
Rui
Posts: 2
Joined: Wed Apr 20, 2022 4:05 pm

Re: Full page screenshot with Page.captureScreenshot

Post by Rui »

Hi,

I had already seen the demos and had already googled it, but because chrome continues to evolve and you can take a full screenshot in chrome through the devtools using run commands I thought there was an easy way to do it.

Over the weekend I updated cef4delphi to version 109 which seems to be the last one with support for windows 7 and did some testing. I noticed that Page.captureScreenshot behaves differently from the version I had previously installed, using the clip parameter we can now take a full screenshot, we just have to indicate the width and height of the content and this we can obtain using Page.getLayoutMetrics - cssContentSize.

But you're right it's not easy to capture the complete page and some pages appear incomplete with images missing even after we go to the bottom of the page and all the images have been loaded.
Post Reply