You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "/usr/local/src/generate.py", line 18, in <module>
page.pdf(
File "/usr/local/lib/python3.10/dist-packages/playwright/sync_api/_generated.py", line 11703, in pdf
self._sync(
File "/usr/local/lib/python3.10/dist-packages/playwright/_impl/_sync_base.py", line 115, in _sync
return task.result()
File "/usr/local/lib/python3.10/dist-packages/playwright/_impl/_page.py", line 1140, in pdf
encoded_binary = await self._channel.send("pdf", params)
File "/usr/local/lib/python3.10/dist-packages/playwright/_impl/_connection.py", line 61, in send
return await self._connection.wrap_api_call(
File "/usr/local/lib/python3.10/dist-packages/playwright/_impl/_connection.py", line 528, in wrap_api_call
raise rewrite_error(error, f"{parsed_st['apiName']}: {error}") from None
playwright._impl._errors.Error: Page.pdf: Protocol error (Page.printToPDF): scale is outside of [0.1 - 2] range
Note that the scale parameter works when running this outside docker on a mac M1 machine. however, this seems to be a bug when running this on any windows instance. the only other reference i found online was here, which wasn't associated with playwright: https://forum.obsidian.md/t/unable-to-export-to-pdf/54877/15
Expected behavior
the pdf is created successfully with the scale factor applied
Actual behavior
Traceback (most recent call last):
File "/usr/local/src/generate.py", line 18, in <module>
page.pdf(
File "/usr/local/lib/python3.10/dist-packages/playwright/sync_api/_generated.py", line 11703, in pdf
self._sync(
File "/usr/local/lib/python3.10/dist-packages/playwright/_impl/_sync_base.py", line 115, in _sync
return task.result()
File "/usr/local/lib/python3.10/dist-packages/playwright/_impl/_page.py", line 1140, in pdf
encoded_binary = await self._channel.send("pdf", params)
File "/usr/local/lib/python3.10/dist-packages/playwright/_impl/_connection.py", line 61, in send
return await self._connection.wrap_api_call(
File "/usr/local/lib/python3.10/dist-packages/playwright/_impl/_connection.py", line 528, in wrap_api_call
raise rewrite_error(error, f"{parsed_st['apiName']}: {error}") from None
playwright._impl._errors.Error: Page.pdf: Protocol error (Page.printToPDF): scale is outside of [0.1 - 2] range
Additional context
No response
Environment
- Operating System: [Ubuntu 22.04] (in docker)
- CPU: [M1] (but running in docker)
- Browser: [Chromium]
- Python Version: [3.10.1211]
- Other info:
The text was updated successfully, but these errors were encountered:
The problem seems like that you are trying to use a amd64 container on a arm64 host. This is not supported and leads to issues like this. Docker internally will pick the matching platform but the image you are using is not available in linux/arm64 so its falling back to amd64. When changing it to this it works for me. (also without the platform):
FROM --platform=linux/arm64 mcr.microsoft.com/playwright/python:v1.52.0-noble
(Looks like something is going wrong with the QEMU user-mode binary translator Docker is using.)
I'll close it for now since this is not a Playwright bug.
Version
1.52.0
Steps to reproduce
In Docker:
In a file named generate.py
then, run through docker using
and we get the following error:
Note that the scale parameter works when running this outside docker on a mac M1 machine. however, this seems to be a bug when running this on any windows instance. the only other reference i found online was here, which wasn't associated with playwright: https://forum.obsidian.md/t/unable-to-export-to-pdf/54877/15
Expected behavior
the pdf is created successfully with the scale factor applied
Actual behavior
Additional context
No response
Environment
The text was updated successfully, but these errors were encountered: