Looking for a way to convert HTML (which I build inside another workflow) into a PDF, preferably inside my own network. So I found Gotenberg, which looks very promising.
Their API expects a file named index.html: HTML API call and I don’t yet understand how to do that in n8n: should I write my HTML into a file like that? And call the API with a path to that file (but where would that path point to)?
Gotenberg looks nice. I tested it out and it works well.
They have a docker which you can run locally. You need to call their API to get a PDF from a URL you pass
Then for n8n, I would assume you need to write the html to a local file and present it on a localip:port/document.html or pass it as a binary to the gotenberg endpoint.
Sure, I have their docker image running here already. The missing bit for me is how to get the HTML output of my other node(s) into the Webhook-Call or the HTTP-Request. I might ask the Gotenberg-people also.
If it is possible to “store” the generated HTML in some kind of temporary file usable by the workflow, this would be a possibility, right?
Thank you, yes, I already had something similar. So far not yet successful, but I am a newbie so that has to be expected
“JSON to binary” requires JSON as input, sure, so I have to add a node to convert HTML to JSON first. That’s my next step.
(In the end I will have to write a HTML document containing data from multiple JSON objects, adding some css-formatting, and this should be converted into a PDF, then pushed into some API again. At least that’s my current plan)
After reading the docs, the [email protected]/path/to/file seems to indicate it needs a file on its local disk.
It cannot be passed in using the form-data from my testing.
You will need to write the file on the docker storage of the Gotenberg docker (or better yet, a shared folder between the host, n8n,gotenberg), then pass that relative path to the above node.
I have limited knowledge of share storage on docker so cant help.
Yes. Do you have a recommendation how to host that “temporary” file? I didn’t yet manage to make the mentioned container work, but I was busy with other things. It would be great to have a Node in n8n to do that, right?