Letter footer only in the last page in PDF

Hi,

After creating a letterhead with header and footer, normal preview shows the footer right after invoice content instead of the bottom. Now PDF helps us to have the footer in the bottom as well as in every page.

Issue is, if an invoice has more items which exapands to multiple pages , the last item gets cropped by the footer. The easiest solution is to have the footer only in the last page instead of every pages or the normal preview and print showing the footer in the bottom. I also found that when I print the invoice directly without generating PDF, only the first gets printed.

I would really love have the solution. Is there any coding can I use for the print format or for wkhtmltopdf?

Thanks in advance.

We do have same issue but these are the limitation of html and wkhtml2pdf. I hope someone can look into it and advice how we can achieve dynamic ways of print formats with respect to the footer.

2 Likes

Hello @fnrfarid , Any updates about this ? i still have the same issue…

Hi, @Aghiles

This setting is now available from v14 I think, I’m not sure about v13. If you uncheck the “Repeat Header and Footer in PDF”, Header will be on the first page, and footer will be only on the last page.

Hope this helps.

Thank you for your answer @fnrfarid
I tried it, but the problem now is that the footer is not fixed to the bottom of the page… it’s appearing after the last content of the PDF( if the pdf contains juste some lines, the footer appears in the middle of the page) any solution for this please ?

Unfortunately, no. I didn’t find any solution

I want header and footer on every page of custom print format, verison 13.
do you have any solution for me sir ?

In the custom Jinja print format design, if you add a header and footer like an image, that will be generated for each page in the PDF automatically.

Hi,
I tried that… It doesnot work.


<div class="header">   <!-- HEADER -->
<div style="text-align: center;">
<img alt="Al Yusr Letter Head" height="80px"  src="" width="100px">
</div>
<p><b>VATIN #:</b>OM11######</p>
<hr>
</div>

<div class="footer">
<p class="text-center small page-number hidden-pdf">
			{{ _("Page {0} of {1}").format('<span class="page"></span>', '<span class="topage"></span>') }}
		</p>
  <p style="text-align: justify">  <!-- FOOTER -->
   *** Any Discrepancy of consignments delivered  at your site/store should be brought to our notice within <b>24 Hours</b> from the time of receipt *** <br />
  </p>
 <hr>
<div style="text-align: center;">
<img alt="Al Yusr Letter Head" height="120px" src="" width="900px">
</div>
</div>

The below code is That I am using for custom print formats, but when I print, the page content overlaps the header and the footer. secondly I also cannot get the Pagination.
Please Look in this Issue, I have been stuck for 3 weeks now.


<table class="super">
  <thead><tr><td>
    <div class="header-space">
&nbsp;
</div>
</td></tr></thead>
 <tbody><tr><td>
<div class="page"></div>
</td></tr></tbody>
  <tfoot><tr><td>
    <div class="footer-space">&nbsp;</div>
  </td></tr></tfoot>
</table>
<div id="header-html" class="hidden-pdf row section-break">
		
	<div class="letter-head"><div><img src="ENTER YOUR IMAGE URL HERE" style="width: 861px;"><br></div></div>		    
		<div class="print-heading" style="padding-bottom: 6px !important; margin-bottom: 3px;">
			<div class="2nd-head" style="padding-top: 6px !important;">
				<p style="display: inline-block; text-align: left; width: 33%; ">{{ doc.name }}</p>
				<p style="display: inline-block; text-align: center; width: 32%; "><b>Delivery Note</b></p>
				<p style="display: inline-block; text-align: right; width: 33%;">{{ doc.get_formatted("territory") }}</p>
			</div> 
		</div>
	</div>


		<div class="row section-break" style="margin: 0px !important">
			<table class="col-xs-6">
				<tr>
					<td style="font-size: 14px;  padding: 0px !important;">Customer</td>
					<td class="text-center" style="padding: 0px 16px !important;">:</td>
					<td style="font-size: 14px; padding: 0px !important;">{{ doc.get_formatted("customer_name") }}</td>
				</tr>
			</table>
		</div>

<table class="table table-bordered">
	<tr>
        <th class="text-left">Sl.</th>
        <th class="text-center">Item Name</th>
        <th class="text-center">Qty</th>
    </tr>
    {%- for row in doc.items -%}
    	<tr>
            <td class="text-left">{{ row.idx }}</td>
            <td class="text-left">{{ row.item_name }}</td>
            <td class="text-right">{{ row.qty }}</td>
        </tr>
		{% if row.serials  %}
		<tr>
            <td colspan="2" class="text-left"> 
                <b>Serials: </b>{{ row.serials }}
            </td>
            <td colspan="1"></td>
        </tr>
    	{% else %}
   		{%- endif %}
    {%- endfor -%}
</table>
	


	<footer>

		<div id="footer-html" class="visible-pdf" style="display: block !important; order: 1;">
	
			<div class="letter-head-footer">
				<div>
					<img src="ENTER YOUR IMAGE URL HERE" style="width: 861px;">
				</div>
			</div>
	
			<p class="text-center small page-number visible-pdf">
				Page <span class="page"></span> of <span class="topage"></span>
			</p>
		</div>

	</footer>

This is a sample Delivery Note Jinja Print Format. Between the header and footer, you need to provide the content you want to print. You can take some idea from this and implement your own

I tried this also, Not working

I think that only works with Standard Print Format and if you have a Letter Head created.

I am using this as custom print format in print formats doctype, the letter head is already created, I tried to put the link here in the code as well, but This does not work.