Adding Header and Footer in a Document - Power Automate

Hi,

I’m trying to generate a Job Description document from HTML using Plumsail’s Convert HTML to DOCX action.

Here’s my goal:

  • I have a header image and a footer image that should span the full page width (US Letter 8.5" × 11").

  • The header should appear at the top of every page, the footer at the bottom of every page.

  • The JD body text should have proper left/right margins so it doesn’t stick to the edges.

What I’ve done so far:

  • Uploaded the header image (header.png) and footer image (footer.png) to SharePoint.

  • Converted them to Base64 in Power Automate and included them in the HTML using <img> tags inside <header> and <footer> elements.

  • Wrapped the JD content in a <div> with padding for margins.

  • Used Plumsail “Convert HTML to DOCX” to create the document.

The problem:

  • In the generated DOCX, the header image appears appears misaligned.

  • Even the footer isn’t aligned well.

  • Header only shows on the first page, footer only shows on the last page.

  • Body text stretches to the left and right margin when I select the margin in Plumsail’s action to be “0 0 0 0”

What I need help with:

  • Correct HTML/CSS or Plumsail settings to make the header/footer align properly for US Letter size (8.5" × 11").

  • Ensure the header and footer repeat on all pages.

  • Maintain consistent left/right margins for the body text while keeping header/footer full width.

Here’s an example screenshot of the issue:

In the above image the text of the document are right in place as I need, but the Header is not.

Now, in this image the Header is in place but the texts have stretched to the margins.

Any advice, HTML fix, or tips to achieve this would be greatly appreciated.

Thanks!

Hi @maaz.zayn

As a best practice, it's important to note that HTML doesn't have a built-in way to handle repeating headers and footers on its ­own.

So, based on your user case, I suggest doing this using a DOCX template. You can set up your headers and footers in the template itself, and then just use our HTML function to insert your content into the main body of the document. This way, you have more control over margins, too.

Let me know what you think!

Best regards,
Milagros
Plumsail team