-
Notifications
You must be signed in to change notification settings - Fork 9.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No way to determine native DPR of device #2358
Comments
Easy fix, but why do you need the native DPR? It should be largely irrelevant in headless afaik. |
You want to know this information for taking high quality screenshots. For my particular case, I'm running an app in both mac and linux. So I want to use the correct DPR per the device without hard coding numbers. |
This patch: - teaches page.setViewpot() to accept `null` to disable viewport emulation. - allows passing `0` as deviceScaleFactor to use machine-defined deviceScaleFactor. References puppeteer#1183. Fixes puppeteer#2358.
Why would the dpr of the device affect the screenshot quality? The device doesn’t necessarily have a single dpr |
You need to emulate a viewport with |
Let's introduce a |
The following code doesn't allow someone to use the device's native DPR by setting
await page.setViewport({deviceScaleFactor: 0,...})
:https://github.com/GoogleChrome/puppeteer/blob/master/lib/Page.js#L729
https://github.com/GoogleChrome/puppeteer/blob/294f33b75c5a7c87d447816218438f56c2d56f0e/lib/EmulationManager.js
That makes it impossible to determine the real DPR of the device:
The text was updated successfully, but these errors were encountered: