Header/Footer does not work

Hello @gabtzi,

I tried a simple test custom report this is the code

<div id="htmlheader">
    <h1>Header</h1>
</div>

<h1> Page 1 </h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.
    Fusce vitae massa eget nulla porttitor egestas. Suspendisse vel tincidunt elit.
    Praesent ultricies sit amet neque ac dignissim. Mauris commodo sem sit amet lacus convallis suscipit.
    Suspendisse nulla massa, varius id tellus eget, tincidunt vestibulum libero.
</p>

<div class="page-break"></div>

<h1> Page 2 </h1>
<p>
    In ligula quam, molestie in maximus a, scelerisque et urna. Etiam posuere, lacus sed vehicula scelerisque,
    nibh quam dapibus tortor, id convallis tellus lectus et orci. Fusce hendrerit dui eget iaculis maximus.
    Etiam posuere purus quis erat luctus lobortis. Vivamus scelerisque tempor elit.
    Ut mollis semper ultrices. In tristique dui libero, in malesuada ligula pulvinar eget. Cras sodales luctus rutrum.
</p>

and the print output is this

The header is not repeated after the page break. It should repeat in the second page. Am I doing it right?

Hi I think after @anand rewrote the code you need to use
id=“header-html” and id=“footer-html” accordingly

@gabtzi still does not work. The same output above :frowning: this is my revise code below

<div id="header-html">
    <h1>Header</h1>
</div>

<h1> Page 1 </h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.
    Fusce vitae massa eget nulla porttitor egestas. Suspendisse vel tincidunt elit.
    Praesent ultricies sit amet neque ac dignissim. Mauris commodo sem sit amet lacus convallis suscipit.
    Suspendisse nulla massa, varius id tellus eget, tincidunt vestibulum libero.
</p>

<div class="page-break"></div>

<h1> Page 2 </h1>
<p>
    In ligula quam, molestie in maximus a, scelerisque et urna. Etiam posuere, lacus sed vehicula scelerisque,
    nibh quam dapibus tortor, id convallis tellus lectus et orci. Fusce hendrerit dui eget iaculis maximus.
    Etiam posuere purus quis erat luctus lobortis. Vivamus scelerisque tempor elit.
    Ut mollis semper ultrices. In tristique dui libero, in malesuada ligula pulvinar eget. Cras sodales luctus rutrum.
</p>

@gabtzi maybe it will not work in html? :frowning: We need to ask @anand on this.

Hello @anand does header/footer works in html? because for now we can only generate html for print preview in script report.

wait wait wait are you trying to do this for the HTML view? Fixed headers/footers are only for PDFs .

In HTML there is no separation of pages or page dimensions like in PDFs so you can’t really repeat headers/footers like that.

This only works for the PDF printout.

Hi @gabtzi I am little bit confused :frowning: query report and script report can only render html. so where can I used this feature?

I see, then I think it won’t work there. You can definitely use it for quotations,sales orders and invoices though.

I originally started developing a workaround for this issue as a way to get a legitimate invoice printed physically in the end or sent as a signed PDF via email so when I started doing it I did it for the invoices and tested for the invoices.

I really have no idea how this could be implemented for HTML output though. In HTML the idea is that you can use a “position: fixed” element as header to keep the header always in view as you scroll down so I don’t think the definition of repeatable headers applies in HTML.

@gabtzi I have confirm that this only works for pdf. so its not possible to used this feature in script and query reports. if you like to used the header/footer feature in query and script report better apply this patch https://github.com/frappe/frappe/pull/1517