Download PDF Preview Bytes

async AsyncCogniteClient.documents.previews.download_document_as_pdf_bytes(
id: int,
) bytes

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:

id (int) – The server-generated ID for the document you want to retrieve the preview of.

Returns:

The pdf preview of the document.

Return type:

bytes

Examples

Download PDF preview of file with id 123:

>>> from cognite.client import CogniteClient, AsyncCogniteClient
>>> client = CogniteClient()
>>> # async_client = AsyncCogniteClient()  # another option
>>> content = client.documents.previews.download_document_as_pdf_bytes(id=123)