Header Footer Table Header Repeat Page Break Issue in Print Format - jigneshpshah/greycube_helpmanual GitHub Wiki

For table header to be repeated in print format put thead

<table class="table table-condensed table-hover table-bordered">
    <thead>
  <tr>
    <th>{{_("Item")}} </th>
    <th>{{_("Description")}} </th>
    <th>{{_("Qty")}}</th>
    <th>{{_("Serial No")}}</th>
    <th>{{_("Plate No")}}</th>
    <th>{{_("Rate")}}</th>```




in CSSS


```thead { display: table-header-group } 
tfoot { display: table-row-group } 
tr { page-break-inside: avoid } ```


and for FOOTER

`{% if not no_letterhead and footer %}
    <div class="letter-head-footer">
        {{ footer }}
    </div>
    {% endif %}
    <p class="text-right small page-number visible-pdf">
        {{ _("Page {0} of {1}").format('<span class="page"></span>', '<span class="topage"></span>') }}
    </p>
</div>`


and for Header

`{%- macro add_header(page_num, max_pages, doc, letter_head, no_letterhead) -%}
    {% if letter_head and not no_letterhead %}
    <div class="letter-head">{{ letter_head }}</div>
    {% endif %}
    {%- if doc.meta.is_submittable and doc.docstatus==2-%}
    <div class="alert alert-danger text-center">
        <h4 style="margin: 0px;">{{ _("CANCELLED") }}</h4></div>
    {%- endif -%}
    {% if max_pages > 1 %}
    <p class="text-right">{{ _("Page #{0} of {1}").format(page_num, max_pages) }}</p>
    {% endif %}
{%- endmacro -%}
{{ add_header(0,1,doc,letter_head, no_letterhead) }}`


### Print Settings
uncheck > Allow Page Break in Table

### Page Break after specific

Step 1: add below code in Custom HTML tag / custom print format 

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

Step 2: Click on PDF 

⚠️ **GitHub.com Fallback** ⚠️