Let's talk about the fromSurface parameter introduced in Chrome DevTools Protocol which will soon be supported by Puppeteer or even supported now at the time when you are reading the post.
When fromSurface is set to true, captures screenshot from the surface rather than the view. When it is set to false, works only in headful mode and ignores page viewport (but not browser window’s bounds). Defaults to true.
The option doesn’t make much sense when using headless mode. But to understand how it works, let’s execute the next code in the headful mode:
The window is opened, and it is size is limited by the default window size, but the viewport size is different, so that’s what you would see if you run the code:
So, when fromSurface is set to false, that’s how the screenshot will look like:
By the way, there is a few related articles you might be interested in: