Header, Footer in PDF in Ver 13


My developer is not able to figure out why Header and Footer is not appearing in the PDF in the ver 13 Production instance.

Can somebody please help? Have things changed? Is there anything we are missing?



A couple of things to look at:

Check in the Letter Head list that the letter head is enabled. When previewing using the print icon, check print settings.

All settings are appropriate. But the Header just appears on the first page and the footer does not appear at all.



On print setting
Step 1: uncheck Repeat Header and Footer in PDF field
Step 2: Save & Clear Cache
Step 3: check Repeat Header and Footer in PDF field
Step 4: Save & Clear Cache

I’m still having this issue, does anyone else?

And if any could test on this also…


Hi Jay

I also faced this issue in last weak, even everything is correct but footer was not appearing in pdf. I created a sample custom print format and after that this issue automatically resolved. Make a custom print format add the following code after that other print formats header or footer is working fine.

     <div class="col-xs-12">

           {{ letter_head }}

{% if not no_letterhead and footer %}
{{ footer }}
{% endif %}

Kindly let me know if this works for you.

Best Regards

1 Like

Facing same issue here

I am having the same issue where the Header and Footer only show on the 1st page of the pdf.

The issue appeared after we updated to frappe and erpnext about a month ago. We had not updated the instance for a while before that.

We just updated to ERPNext: v13.16.1 (version-13) and Frappe Framework: v13.16.0 (version-13), and the issue is still present.

We already tried fiddling with the print settings (turning off and then back on to repeat on every page). My programmer seems to think it’s a system bug that needs to be resolved by Frappe.

Can anyone confirm if it’s just us having this issue, or is it affecting everyone else on this version?

Hello @JayRam were you able to find a solution to this problem? We are having the same issue and can’t figure out how to fix it.

We were able to fix this issue by adding a page break in the sales invoice after specified number of lines.

Without the page break, the sales invoice items table was overflowing onto the footer of the first page and both header and footer of the consequent pages.

Also, it might be worthwhile to check if you’re using the latest version of wkhtmltopdf on the server. (wkhtmltopdf)

Thank you @Sambhav_Patni we’ll give this a try.

The link indicates the current stable series is 0.12.6 , which was released on June 11, 2020. Checking our server looks like we have version 12.5 (with patched qt) - whatever that means.

erpnext@erpnext:~$ wkhtmltopdf --version
wkhtmltopdf 0.12.5 (with patched qt)

What would be the correct way to upgrade this?

I’m having this same issue where the header and footer won’t print on the pdf even though they show up in html print view.

I’ve tried mutliple permutations of host_name":"http://mywebsite in the config file.
I’ve installed libssl-dev

Any other suggestions?

I wrestled hard with this one, but upgrading to the latest version of wkhtmltopdf (0.12.6) with the qt patches fixed it this problem for me. Here is the process I followed:

I used wget to download the latest version of it from here: (in my case the amd64 debian version)

And then I unpackaged it. I had to install a few dependencies (xfonts-75dpi), but this fixed it so that now running this from command line:
sudo wkhtmltopdf -V
Results in this:
wkhtmltopdf 0.12.6 (with patched qt)

I am running ERPNEXT v 13 on a google hosted debian vm. The problem is that the version of wkhtmltopdf that was installed on my vm was not compiled with the qt patches and could therefore was not able to build a pdf with the header or footer options. (You can read the FAQ on the download page I linked above for more info.)


1 Like

Just add this after html content

{% if print_settings.repeat_header_footer %}
	<div id="footer-html" class="print-footer">
		{% if not no_letterhead and footer %}
            <div style="position: relative;">
                <div class="letter-head-footer">
			        {{ footer }}
		{% endif %}
		<p class="text-right small page-number visible-pdf" style="font-family: Cairo;">
			{{ _("الصفحة {0} من {1}").format('<span class="page" style="color:#2166b1;"></span>', '<span class="topage" style="color:#2166b1;"></span>&nbsp;&nbsp;') }}
{% endif %}

Add the class of “footer-html” as following and remove class ’ visible-pdf’ from the div
<div id="footer-html" class="print-footer">
and in css add:
@media print {
.print-footer {
position: fixed;
bottom: 0;

1 Like

Thank you @WHP-Jeff

If I already have installed version 0.12.5, do I need to uninstall it first prior to installing 0.12.6? If so, what exact steps should be followed to uninstall? Or should I simply install 0.12.6 on top of 0.12.5 without uninstalling the old version first?

How will I know if I have to install dependencies like you did?

In my linux system (Ubuntu 20.04) wkhtmltopdf was installed with erpnext and not on its own, so I’m unable to uninstall using sudo apt-get remove wkhtmltopdf --purge.

Typing locate wkhtmltopdf shows:

erpnext@erpnext-server:~$ locate wkhtmltopdf

When installing the new version, which directory should I use to download with wget, and what specific steps should be followed to install?

Thank you very much for your help.

I was able to upgrade wkhtmltopdf to version 0.12.6 (with patched qt) by simply following this.

The bad news is that it did not fix my issue; when I print the Sales Orders etc to pdf, the company logo (letterhead) only appears on the first page and not on the following ones. This only happens if I access the webpage from the internet (typing erpnext.mydomain.com) whereas the logo issue does not happen if I access the webpage from inside the LAN where the web server is located i.e. http://192.168.x.x.

I have not installed SSL/TLS on the ERPNext server, instead I rely on my reverse proxy which has the SSL/TLS Certificate installed for the subdomain.

My next step will be to enable https on the erpnext server to see if it solves the issue.

I have been able to solve the issue by simply opening port 80 and creating a port forward rule on the security gateway / router. After doing this, I am able to print pdf’s with the company logo on all pages.


Issue Resolved when Wkhtmltopdf is downgraded to version 0.12.5( patched qt ). Try uninstalling 0.12.6 and reinstall 0.12.5. Check version to make sure it is patched qt.

Could you elaborate on what you did? I have wkhtlmtopdg 0.12.6 (with patched qt).
My server is behind an Nginx reverse proxy with the following config:

server {

    # You can specify multiple domain names if you want
    server_name erp.example.com;

    location / {

        proxy_http_version 1.1;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_set_header X-Real_IP $remote_addr;

        proxy_cache off;

        client_max_body_size 25m;
        add_header 'Cache-Control' 'no-store, no-cache, must-revalidate, proxy-r
evalidate, max-age=0';
        expires off;

    access_log /var/log/nginx/erp/access.log;
    error_log /var/log/nginx/erp/error.log;

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/erp.example.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/erp.example.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot


server {

    if ($host = erp.example.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    listen 80;
    listen [::]:80;

    server_name erp.example.com;


My router is set to forward all requests to ports 80 and 443 to the nginx server.
Only way my problem differs from yours is that PDF generation doesn’t work for me inside my LAN either, even if I access it through it’s ip.