Letter Head image not coming in the PDF file exported from Print preview

I have setup Header and Footer. Both are images that I have uploaded.

When previewing a Sales Invoice I can see the header and footer but when I export the preview to PDF the PDF that gets generated does not contain Header and Footer.

Here is the screenshot of Print Preview.

When I click on the PDF button that is what is coming without the Letter Head.

How to solve this?


1 Like


I have not tired this but if the problem persist do try to build Letter Head using pure HTML. It will be easier and better.


Yogi Yang

Finally I have found a solution.

I created a new section and placed it as the very top. Then in it I added the HTML control and placed the HTML code…

<div style="text-align: center;">
<img alt="ETPL Main" height="" src="/files/letter_head_header4f8b37.jpg" style="height: px;">

<div class="print-heading">
		<small>{{ doc.name }}</small>
<h2 class="text-center">
	{% if doc.invoice_copy -%}
		<small>{{ doc.invoice_copy }}</small>
	{% endif -%}

This worked for me!!

Now when we export to PDF the letter head is also being exported.

Of course this is static and does get repeated on each page. Ideally I want to repeat the header on each page when there are multiple pages.


Where have you created a new section??
Actually, I’m little bit confused.

In your Sales Order or Sales Invoice click on print icon

In the print preview click on … button and then select Customize in the menu.

Here if the print format selected is one of the prebuilt formats then it will ask you for a new name. Enter a new name and it will show Print Format Edit interface.
Here go to the bottom and you will find a button. Click on this to add a New Section.


You might need to upgrade wkhtmltopdf

sudo apt update -y

wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6.1-2.jammy_amd64.deb


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

sudo apt install ./wkhtmltox_0.12.6.1-2.jammy_amd64.deb