> ## Documentation Index
> Fetch the complete documentation index at: https://developer.upsun.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Gotenberg

> Gotenberg is a user-friendly API for PDF files.

Gotenberg is a stateless API for converting various document formats into PDF files.
For more information, see the [Gotenberg documentation](https://gotenberg.dev/docs/getting-started/introduction).

## Supported versions

* 8

You can select the major version. But the latest compatible minor version is applied automatically and can’t be overridden.

Patch versions are applied periodically for bug fixes and other maintenance updates. By default, you get the latest available patches each time you deploy. If your project has a [maintenance window](https://developer.upsun.com/docs/core-concepts/build-deploy.md#maintenance-window) configured, Upsun Cloud applies patches only during that window. Upsun Cloud may still apply urgent or critical fixes outside of the maintenance window.

## Deprecated versions

The following versions are still available in your projects,
but they're at their end of life and are no longer receiving security updates from upstream.

*No deprecated versions.*

To ensure your project remains stable in the future,
switch to a [supported version](#supported-versions).

## Retired versions

The following versions have been retired and are no longer available.
If your project uses a retired version, you must update to a [supported version](#supported-versions).

*No retired versions.*

## Relationship reference

For each service [defined via a relationship](#usage-example) to your application,
Upsun Cloud automatically generates corresponding environment variables within your application container,
in the `$<RELATIONSHIP-NAME>_<SERVICE-PROPERTY>` format.

Here is example information available through the [service environment variables](https://developer.upsun.com/docs/development/variables#service-environment-variables) themselves,
or through the [`PLATFORM_RELATIONSHIPS` environment variable](https://developer.upsun.com/docs/development/variables/use-variables#use-provided-variables).

> [tab] Service environment variables
>
> You can obtain the complete list of available service environment variables in your app container by running `upsun ssh env`.
>
> Note that the information about the relationship can change when an app is redeployed or restarted or the relationship is changed. So your apps should only rely on the [service environment variables](https://developer.upsun.com/docs/development/variables#service-environment-variables) directly rather than hard coding any values.
>
> ```bash theme={null}
> GOTENBERG_INSTANCE_IPS=["249.45.240.83"]
> GOTENBERG_SCHEME=http
> GOTENBERG_HOSTNAME=rssjaxyeoorjje6axcq35xu5gq.gotenberg.service._.eu-5.platformsh.site >}}
> GOTENBERG_SERVICE=gotenberg
> GOTENBERG_CLUSTER=p2f2xrzyq7a6k-main-bvxea6i
> GOTENBERG_IP=169.254.137.3
> GOTENBERG_TYPE=gotenberg:8
> GOTENBERG_HOST=gotenberg.internal
> GOTENBERG_PORT=3000
> GOTENBERG_REL=http
> ```

> [tab] `PLATFORM_RELATIONSHIPS` environment variable
>
> For some advanced use cases, you can use the [`PLATFORM_RELATIONSHIPS` environment variable](https://developer.upsun.com/docs/development/variables/use-variables#use-provided-variables).
> The structure of the `PLATFORM_RELATIONSHIPS` environment variable can be obtained by running `upsun relationships` in your terminal:
>
> &#x20;       \{
> &#x20;         "host": "gotenberg.internal",
> &#x20;         "hostname": "rssjaxyeoorjje6axcq35xu5gq.gotenberg.service.\_.eu-5.platformsh.site",
> &#x20;         "cluster": "p2f2xrzyq7a6k-main-bvxea6i",
> &#x20;         "service": "gotenberg",
> &#x20;         "rel": "http",
> &#x20;         "scheme": "http",
> &#x20;         "port": "3000",
> &#x20;         "type": "gotenberg:\{\{version:gotenberg:latest}}",
> &#x20;         "instance\_ips": \[
> &#x20;           "249.45.240.83"
> &#x20;         ],
> &#x20;         "ip": "169.254.137.3",
> &#x20;         "url": "[http://gotenberg.internal:3000](http://gotenberg.internal:3000)"
> &#x20;       }
> &#x20;    &#x20;
>
> Here is an example of how to gather [`PLATFORM_RELATIONSHIPS` environment variable](https://developer.upsun.com/docs/development/variables/use-variables#use-provided-variables) information
> in a [`.environment` file](https://developer.upsun.com/docs/development/variables/set-variables#when-to-use-env-files):
>
> ```bash .environment theme={null}
> # Decode the built-in credentials object variable.
> export RELATIONSHIPS_JSON="$(echo "$PLATFORM_RELATIONSHIPS" | base64 --decode)"
>
> # Set environment variables for individual credentials.
> export APP_GOTENBERG_HOST=="$(echo $RELATIONSHIPS_JSON | jq -r '.gotenberg[0].host')"
> ```

## Usage example

### 1. Configure the service

To define the service, use the `gotenberg` type:


&#x20;   services:
&#x20;     \# The name of the service container. Must be unique within a project.
&#x20;     \<SERVICE\_NAME>:
&#x20;       type: gotenberg:\<VERSION>
&#x20;&#x20;

Note that changing the name of the service replaces it with a brand new service and all existing data is lost. Back up your data before changing the service.

### 2. Define the relationship

To define the relationship, use the `http` endpoint:

> [tab] Using default endpoints
>
> &#x20;       applications:
> &#x20;         \# The name of the app container. Must be unique within a project.
> &#x20;         \<APP\_NAME>:
> &#x20;           \# Relationships enable access from this app to a given service.
> &#x20;           \# The example below shows simplified configuration leveraging a default service
> &#x20;           \# (identified from the relationship name) and a default endpoint.
> &#x20;           \# See the Application reference for all options for defining relationships and endpoints.
> &#x20;           relationships:
> &#x20;             \<SERVICE\_NAME>:
> &#x20;    &#x20;
>
> You can define `SERVICE_NAME` as you like, so long as it’s unique between all defined services and matches in both the application and services configuration.

> [tab] Using explicit endpoints
>
> &#x20;       applications:
> &#x20;         \# The name of the app container. Must be unique within a project.
> &#x20;         \<APP\_NAME>:
> &#x20;           \# Relationships enable access from this app to a given service.
> &#x20;           \# The example below shows configuration with an explicitly set service name and endpoint.
> &#x20;           \# See the Application reference for all options for defining relationships and endpoints.
> &#x20;           relationships:
> &#x20;             \<RELATIONSHIP\_NAME>:
> &#x20;               service: \<SERVICE\_NAME>
> &#x20;               endpoint: http
> &#x20;    &#x20;
>
> You can define `SERVICE_NAME` and `<RELATIONSHIP_NAME>` as you like, so long as it's unique between all defined services and relationships
> and matches in both the application and services configuration.

With the above definition, Upsun Cloud uses the `http` endpoint,
providing a [relationship](https://developer.upsun.com/docs/configure-apps/image-properties/relationships.md) (the network address a service is accessible from) that is identical to the *name* of that service.

The `http` endpoint uses port `3000` by default.

### Example configuration

> [tab] Using default endpoints
>
> ```yaml .upsun/config.yaml theme={null}
> applications:
>   # The name of the app container. Must be unique within a project.
>   myapp:
>     # Relationships enable access from this app to a given service.
>     # The example below shows simplified configuration leveraging a default service
>     # (identified from the relationship name) and a default endpoint.
>     # See the Application reference for all options for defining relationships and endpoints.
>     relationships:
>       gotenberg:
> services:
>   # The name of the service container. Must be unique within a project.
>   gotenberg:
>     type: gotenberg:8
> ```

> [tab] Using explicit endpoints
>
> &#x20;       applications:
> &#x20;         \# The name of the app container. Must be unique within a project.
> &#x20;         myapp:
> &#x20;           \# Relationships enable access from this app to a given service.
> &#x20;           \# The example below shows configuration with an explicitly set service name and endpoint.
> &#x20;           \# See the Application reference for all options for defining relationships and endpoints.
> &#x20;           relationships:
> &#x20;             gotenberg:
> &#x20;               service: gotenberg
> &#x20;               endpoint: http
> &#x20;       services:
> &#x20;         \# The name of the service container. Must be unique within a project.
> &#x20;         gotenberg:
> &#x20;           type: gotenberg:\{\{version:gotenberg:latest}}

## Generate a PDF using Gotenberg

As an example, to generate a PDF file of the {{config_company_name}} website, run the following cURL command:

```bash Terminal theme={null}
curl \
--request POST http://yduimhaby523ase4lju3qhimre.gotenberg8.service._.eu-3.platformsh.site/forms/chromium/convert/url \
--form url=https://upsun.com \
--form landscape=true \
--form marginTop=1 \
--form marginBottom=1 \
-o my.pdf
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.