Creating a pdf merger Web Application using chatgpt AI

n00🔑
3 min readJan 31, 2023

Hi readers, recently I was filling up an online form and it was required to merge, upload and submit documents in pdf format. Usually, I tend to use free online tools for merging pdfs(like ilovepdf, etc). But this time the files which I was uploading contained PII and financial information. We as end users have no visibility of what these online websites do with our data contained in the pdf files which we upload to them. So I started looking for open-source alternatives, and I was more interested in web-hosted open-source applications. Fortunately, I found this https://github.com/gotenberg/gotenberg project which fulfills the need to do multiple things with pdfs. I was able to deploy a full-fledged web app in under 15 minutes with a little bit of help from CHATGPT.

It exposes multiple APIs for each functionality. For example, for merging pdfs we have this API-

curl \
--request POST 'http://localhost:3000/forms/pdfengines/merge' \
--form 'files=@"/path/to/pdf1.pdf"' \
--form 'files=@"/path/to/pdf2.pdf"' \
--form 'files=@"/path/to/pdf3.pdf"' \
--form 'files=@"/path/to/pdf4.pdf"' \
-o my.pdf

You can read more about these here at documentation- https://gotenberg.dev/docs/modules/pdf-engines

Okay, so far so good. Now let us deploy gotenberg-

Prerequisites: a) docker b) laziness

#sudo apt update -y && sudo apt install docker.io -y

Steps

--

--