The all-in-one microservice to manage PDF

Francesco Pastore
3 min readNov 27, 2022

PDF is one of the most common ways used to share data. It is mainly chosen for portability because a PDF file structure does not change between different systems.

Working with PDF in your app could not be a piece of cake. Some languages do not have good libraries and conversions between different file types are not so easy. Don’t worry, Gotenberg can help!

Wait, what is Gotenberg?

Gotenberg is a microservice written in Go and made to be run as a docker container in your server. It allows managing PDF easily by using its very straightforward API.

In this article, we will some examples of interactions with Gotenberg, but first, how can we start using it?


Gotenberg can be run easily by using the official Docker image from Docker Hub.

docker run --rm -p 3000:3000 gotenberg/gotenberg:7
One line and everything is ready

There is also a live demo available with some limitations. Look to the official documentation for more details about it.

PDF merge? No problem!

If you need to merge multiple PDF files you can call the endpoint by doing a POST request with the files passed inside the body. Remember to use form files available in every HTTP request library.

curl --request POST 'http://localhost:3000/forms/pdfengines/merge' \
--form 'files=@"./sample1.pdf"' \
--form 'files=@"./sample2.pdf"' \
-o merged.pdf

Official docs

There are a lot of features available like Office files to PDF or markdown to PDF. Look to the documentation for all the details about them and the ones shown here.

Custom HTML file to PDF

curl \
--request POST 'http://localhost:3000/forms/chromium/convert/html' \
--form 'files=@"./index.html"' \
-o my.pdf

Public website URL to PDF

curl \
--request POST 'http://localhost:3000/forms/chromium/convert/url' \
--form 'url=""' \
-o my.pdf

One note about authentication

Pay attention to authentication, it is better to make Gotenberg available only to the internal network. Otherwise, you could add special endpoints to your back end that allows accessing the pod from the Internet.

In every case remember that Gotenberg has no authentication service, so be careful of whom can access it.

Gotenberg can be a big help in your applications if you need to manage PDFs. Give it a try and let me know if you find it useful!



Francesco Pastore

An engineering student in Milan and a web developer for an IT company. Write about programming and cybersecurity topics.