Print PDF: Header & Footer not showing (letterhead)

Hey all,

i have problems with printing header & footer on pdfs. (problem only occurs on pdf, at webpreview header & footer shown)

Used Version:
erpnext 13.18.0
frappe 13.18.0
wkhtmltopdf 0.12.5

What i tried at the moment:

  1. CSS loading problems
    I don’t have css problems in pdf, the css loaded in my pdfs

  2. Settings
    I also tried the “hostname” settings advices of the forum

  3. Custom Format instead of “Print Format Builder”
    I try to code the template with jinja but i had no luck with that either, when i add the

    • header into, the following html (whether with or without class=“hidden-pdf” or class=“visible-pdf”), header not working in pdf
      <div id=“header-html”>{{ letter_head }}</div>

    • footer into, same here with the following html (whether with or without pdf classes)
      <div id=“footer-html”>{{ footer }}</div>

    It only show the header & footer if i print {{ letter_head }} and {{ footer }} outside of the divs. (but obviously this only without absolute position & repeating)

  4. wkhtmltopdf version problems
    With the wkhtmltopdf i also dont have problems, the pdf generation works.

  5. /frappe/templates/print_formats/{standard.html | standard_macros.html} /
    I also try to manipulate the html files, but its a little bit hard for me to debug because i’m not an python developer

Workflow & Settings

  1. new print-format
    I add a new print-format for doctype “Sales Invoice” (module: Accounts) with the following style settings

    • Show Section Sections
  2. print settings
    i activate the following checkboxes

    • Send Print to PDF
    • Repeat Header and Footer in PDF
    • Print with letterhead
    • Compact Item Print
    • Print UOM after Quantity
    • Allow Print for Dradft
    • Allow page breaks inside tables
    • Allow Print for Cancelled
    • Print Style (use the print-format added above)

When printing the sales invoice i also choose the defined print-format from above and choose also the letter head,

in the preview html all works fine, but clicking on “pdf” dont show the header and footer.

I also tried all predefined templtes, i have the problem with all templates (also with sales order, quotation etc.)

I hope i have described them clearly enough.

regards and thx Daniel

1 Like

Have you tried upgrading wkhtmltopdf to 0.12.6 ??


Are you using the images in header and footer for the letterhead? Make sure both header and footer images as uploaded in letterhead and accessible.

hey, thanks for your fast response.

i’ve upgrade the wkhtmltopdf now and now it works!

thank you so much

hey, no there are text and images.

anway, it was the wkhtml version.

also thank you for your fast response and help

how to update wkhtmltopdf from 0.12.5 to 0.12.6.
please tell me which command I should use so that existing server not interrupt.
Thank you…

Hi @megha007

I presume you must have installed wkhtmltopdf using the sudo apt method.

If so you could remove the version by simply doing

sudo apt remove wkhtmltopdf

Then go to the wkhtmltopdf website and select the package appropriate to you OS version.

To install in Ubuntu 22.04


sudo dpkg -i wkhtmltox_0.12.6.1-2.jammy_amd64.deb

sudo cp /usr/local/bin/wkhtmlto* /usr/bin/

sudo chmod a+x /usr/bin/wk*


To me above solution helped. My system was also missing a dependency xfonts-75dpi.
doing sudo apt install xfonts-75dpi helped too.

This worked, Looks like upstream pkg have some compatibility issues


1 Like