Skip to content

API Responses

gotenberg_client.SingleFileResponse dataclass

Response containing a single PDF file.

This response type is returned by Gotenberg API operations that produce a single output file, such as: - Converting a single document to PDF - Merging multiple PDFs into one - Converting HTML to PDF

The content will be a binary PDF file that can be saved using the to_file() method.

Attributes

is_zip: bool cached property

Determine if the response contains a ZIP archive.

Returns:

Type Description
bool

True if the Content-Type header indicates a ZIP file, False otherwise.

Functions

to_file(file_path: Path) -> None

Write the response content to a file.

This method allows storing the raw response content (typically a PDF) directly to the filesystem.

Parameters:

Name Type Description Default
file_path Path

Path where the content should be saved.

required

gotenberg_client.ZipFileResponse dataclass

Response containing multiple files packaged as a ZIP archive.

This response type is returned by Gotenberg API operations that produce multiple output files, such as: - Converting multiple documents in a single request - PDF splitting operations - Operations with the multiple=true parameter

The content will be a binary ZIP file containing multiple PDFs.

Attributes

is_zip: bool cached property

Determine if the response contains a ZIP archive.

Returns:

Type Description
bool

True if the Content-Type header indicates a ZIP file, False otherwise.

Functions

extract_to(directory: Path) -> None

Extract all files from the ZIP archive to a specified directory.

Parameters:

Name Type Description Default
directory Path

The target directory where files should be extracted.

required

Raises:

Type Description
CannotExtractHereError

If the directory doesn't exist or isn't a directory.

to_file(file_path: Path) -> None

Write the response content to a file.

This method allows storing the raw response content (typically a PDF) directly to the filesystem.

Parameters:

Name Type Description Default
file_path Path

Path where the content should be saved.

required

gotenberg_client.HealthStatus

The overall health of the Gotenberg service and its modules which report health

This class parses the raw health check API response and provides structured access to overall system status and individual module statuses.

Attributes:

Name Type Description
data

The raw health check API response data.

overall StatusOptions

The overall status of the system.

chromium Optional[ModuleStatus]

The status of the Chromium module, if available.

uno Optional[ModuleStatus]

The status of the Uno module, if available.

gotenberg_client._health.ModuleStatus dataclass

Data class representing the status of an individual module.

Attributes:

Name Type Description
status StatusOptions

The current operational status of the module.

timestamp datetime

The datetime when the status was last checked.

gotenberg_client._health.ModuleOptions

Enumeration of available modules that can be health-checked.

Attributes:

Name Type Description
Chromium

The Chromium browser module used for HTML processing.

Libreoffice

The LibreOffice module used for document conversion.

gotenberg_client._health.StatusOptions