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:
CSS loading problems
I don’t have css problems in pdf, the css loaded in my pdfs
Settings
I also tried the “hostname” settings advices of the forum
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)
wkhtmltopdf version problems
With the wkhtmltopdf i also dont have problems, the pdf generation works.
/frappe/templates/print_formats/{standard.html | standard_macros.html} / pdf.py
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
new print-format
I add a new print-format for doctype “Sales Invoice” (module: Accounts) with the following style settings
Show Section Sections
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.)
However if i unselect the Print Settings - PDF Settings ‘Repeat Header & Footer’ option, I get the Logo in the both the print preview and the generated PDF, but the footer (from the letterhead) moves all the way up. Like below
The weird thing is, I’m running 2 companies on two different ports. The first company doesn’t have any of these issues. However, the newly created company on a different port is having these problems.
Has anyone experienced this issue?, Any help on this matter is really appreciated.