Skip to main content
Version: 6.x

URL

Gotenberg provides the endpoint /convert/url for remote URL conversions.

It accepts POST requests with a multipart/form-data Content-Type.

Basic

This endpoint does not accept an index.html file nor assets files but a form field named remoteURL instead. Otherwise, URL conversions work the same as HTML conversions.

tip

When converting a website to PDF, you should remove all margins. If not, some of the content of the page might be hidden.

If you try to convert a URL from a Docker Compose service named app (i.e. removeURL = http://app/an/entrypoint), the resulting PDF will be blank. Make sure to rename your service to avoid this issue.

curl --request POST \
--url http://localhost:3000/convert/url \
--header 'Content-Type: multipart/form-data' \
--form remoteURL=https://google.com \
--form marginTop=0 \
--form marginBottom=0 \
--form marginLeft=0 \
--form marginRight=0 \
-o result.pdf

Custom HTTP headers

You may send your own HTTP headers to the remoteURL.

For instance, by adding the HTTP header Gotenberg-Remoteurl-Your-Header to your request, the API will send a request to the remoteURL with the HTTP header Your-Header.

caution

The API uses a canonical format for the HTTP headers: it transforms the first letter and any letter following a hyphen to upper case; the rest are converted to lowercase. For example, the canonical key for accept-encoding is Accept-Encoding.

curl --request POST \
--url http://localhost:3000/convert/url \
--header 'Content-Type: multipart/form-data' \
--header 'Gotenberg-Remoteurl-Your-Header: Foo' \
--form remoteURL=https://google.com \
-o result.pdf