MCPcopy Index your code
hub / github.com/microsoft/playwright-python / pdf

Method pdf

playwright/_impl/_page.py:1177–1203  ·  view source on GitHub ↗
(
        self,
        scale: float = None,
        displayHeaderFooter: bool = None,
        headerTemplate: str = None,
        footerTemplate: str = None,
        printBackground: bool = None,
        landscape: bool = None,
        pageRanges: str = None,
        format: str = None,
        width: Union[str, float] = None,
        height: Union[str, float] = None,
        preferCSSPageSize: bool = None,
        margin: PdfMargins = None,
        path: Union[str, Path] = None,
        outline: bool = None,
        tagged: bool = None,
    )

Source from the content-addressed store, hash-verified

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]:

Calls 4

locals_to_paramsFunction · 0.90
make_dirs_for_fileFunction · 0.90
async_writefileFunction · 0.90
sendMethod · 0.45