Download PDF Preview to Path
- async AsyncCogniteClient.documents.previews.download_document_as_pdf(
- path: Path | str | IO,
- id: int,
- overwrite: bool = False,
Downloads a pdf preview of the specified document.
Previews will be rendered if necessary during the request. Be prepared for the request to take a few seconds to complete.
- Parameters:
path (Path | str | IO) – The path to save the pdf preview of the document. If the path is a directory, the file name will be ‘[id].pdf’.
id (int) – The server-generated ID for the document you want to retrieve the preview of.
overwrite (bool) – Whether to overwrite existing file at the given path. Defaults to False.
Examples
Download PDF preview of file with id 123 to folder “previews”:
>>> from cognite.client import CogniteClient, AsyncCogniteClient >>> client = CogniteClient() >>> # async_client = AsyncCogniteClient() # another option >>> client.documents.previews.download_document_as_pdf("previews", id=123)