| 1175 | self._browser_context._set_default_timeout_impl(default_timeout) |
| 1176 | |
| 1177 | async def pdf( |
| 1178 | self, |
| 1179 | scale: float = None, |
| 1180 | displayHeaderFooter: bool = None, |
| 1181 | headerTemplate: str = None, |
| 1182 | footerTemplate: str = None, |
| 1183 | printBackground: bool = None, |
| 1184 | landscape: bool = None, |
| 1185 | pageRanges: str = None, |
| 1186 | format: str = None, |
| 1187 | width: Union[str, float] = None, |
| 1188 | height: Union[str, float] = None, |
| 1189 | preferCSSPageSize: bool = None, |
| 1190 | margin: PdfMargins = None, |
| 1191 | path: Union[str, Path] = None, |
| 1192 | outline: bool = None, |
| 1193 | tagged: bool = None, |
| 1194 | ) -> bytes: |
| 1195 | params = locals_to_params(locals()) |
| 1196 | if "path" in params: |
| 1197 | del params["path"] |
| 1198 | encoded_binary = await self._channel.send("pdf", None, params) |
| 1199 | decoded_binary = base64.b64decode(encoded_binary) |
| 1200 | if path: |
| 1201 | make_dirs_for_file(path) |
| 1202 | await async_writefile(path, decoded_binary) |
| 1203 | return decoded_binary |
| 1204 | |
| 1205 | @property |
| 1206 | def video(self) -> Optional[Video]: |