Create a pdf with gotenberg and n8n

Hey :wave:
I would like to generate a pdf with the responses from the form.

For that, I first test on n8n with fake data after that when it will be okay i will create the html page in my code and after that i will send it in n8n to convert in to pdf and then send by email.

Here is my workflow right now :

I generate a static (for test) html code, after that I convert in binary and I convert in pdf with Gotenberg.

Example body HTML :

<body>
  <div class="info-block">
      <div class="left-content">
          <p><strong>AAA-AA-A-1</strong></p>
          <p><strong>Entreprise :</strong>TEST</p>
      </div>
    </div>
    <div>...</div>
 </div>
</body>
<style>
  body {
      font-family: Arial, sans-serif;
      font-size: 12px;
  }
  
  .header {
       ...
  }
</style>

My first problem is :

  • When I convert the html file to binary, the code is incorrect, it executes the css but it also displays

(generate the html file)

(convert in binary)

when I download the response of the conversion in binary here is the html page :

It displays the html but I don’t know why, he writes the code below.

I don’t see my mistake if you see it please help me ^^


  • How can I create a header and footer of my pdf ?

I would like to create a header and footer for all page created during the conversion to html in pdf.
For that I read I need to create a index.html for the body, header.html for the header and footer.html for the footer but, I don’t understand how can I group up to create only one PDF with several html file.

For the moment, Gotenberg create me two different pdf…

Thank you very much if you try to help me :wink:

Tell me if I am not understandable!

Alister

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hi @Alister_Flandrinck

Thanks for posting here and welcome to the community! :cupcake:

Looks like a fun project!
You should be able to combine all the data that you need in just one HTML node. Have you tried using expressions in the HTML node? They will let you pass in information from other nodes.

If you want to share your workflow here and what the desired HTML needs to look like, we could take a look at fixing it :slight_smile:

Hey Ria thanks for your answer !
It was my first idea, but where I should put the header and footer on my code to duplicate it when the pdf has several pages ?

Do you know why when I convert it on binary the html file is buggy ?

See ya :wink:

Hey during this weekend I found a solution for one of my problem.

Instead of using the convert to html block I used the convert to text block and it worked :raised_hands:

Now I need to figure out how can I add a header and footer on each page of my PDF

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.