viewportSize seems not to work with PhantomJS

后端 未结 4 1012
半阙折子戏
半阙折子戏 2021-01-02 01:21

Shouldn\'t the output from this PhantomJS script be 240x320 pixels? I\'m getting a large, default-sized image. clipRect() would seem to render the correct size image, but I

4条回答
  •  青春惊慌失措
    2021-01-02 01:55

    This is a known issue but I found a workaround:

    1. Load the page into an iframe of whatever size you like.
    2. Render a screenshot clipped to the rectangle of the iframe.

    There is code to do it in this repository: https://github.com/jbeuckm/Splasher

提交回复
热议问题