export-html icon indicating copy to clipboard operation
export-html copied to clipboard

Added ability to set the viewport and associated options for screenshots

Open kgf1980 opened this issue 1 year ago • 0 comments

I've created a PR which exposes the "fromSurface" screenshot option, as well as adding the ability to specify the viewport to use when creating a screenshot - when requesting a specific viewport size you also need to set fullPage to false (perhaps this should automatically happen if viewport options are provided?)

Example usage:

curl --location 'http://localhost:2305/1/screenshot' \
--header 'Content-Type: application/json' \
--data '{
    "url": "https://news.ycombinator.com",
    "export": {
        "type": "png",
        "fullPage": false,
        "fromSurface": false,
        "viewport": {
            "width": 800,
            "height": 480
        }
    }
}' \
--output test.png

kgf1980 avatar May 02 '24 11:05 kgf1980