Blog

Back to blog posts

Set ViewPortOptions on Chrome > Screenshot API

Published Dec 22, 2021

We are proud to announce an enhancement to our /chrome/image endpoints which are quickly gaining popularity. You can now declare a custom ViewPort option. Prior to this, you were locked into a 1920 x 1080 viewport, which is the equivalent of a wide screen monitor. However, there may be use cases where you want to simulate screenshots of different viewports. Below is a screenshot from our documentation demonstrating how to set a custom viewport. This is an optional portion of the payload, and leaving it out will default to 1920 x 1080 to maintain backwards compatibility.

Behind the scenes, API2PDF is using PuppeteerSharp which is a library that writes a convenient interface on top of Google Chrome. We pass these parameters through when the screenshot is taken.