Custom Print Format: Header and Footer not repeating

Hi,

I’m facing an issue with repeating headers and footers in a Custom Print Format.

My setup is:

  • Frappe v16
  • Hosted on Frappe Cloud
  • PDF Render Engine: Chromium
  • Repeat Header and Footer: Enabled in Print Settings
  • Custom HTML Print Format

Requirements:

  1. The header and footer should repeat on every page of the generated PDF.
  2. I want the page margin to be 5 mm instead of the default ~15 mm.
  3. I want a border around the page itself, positioned relative to the physical page margin, not relative to the .print-format content area.

For testing the repeating header/footer, I tried the following basic markup:

<div class="print-format">
    <div id="header-html" class="print-heading">
        Header Text
    </div>
    <div class="body-section" style="padding-bottom: 2000px">Body Section</div>
    <div id="footer-html">
    Footer Text
    </div>
</div>

However, the header and footer are not repeating on subsequent pages, even though the repeat option is enabled.

Could someone please clarify the correct approach for Frappe v16 with the Chromium renderer, particularly:

  • How should repeating headers and footers be defined in a Custom Print Format?
  • How can I correctly set the PDF page margin to 5 mm?
  • How can I add a page-level border that follows the 5 mm page margin and repeats on every page?

I would appreciate a working HTML/CSS example if possible.

Thanks in advance.

Hi @subhra

I used wkhtmltopdf in Printing page number in the print format - #8 by asieftejani

Hope it helps

It working repeating header and footer using Chromium