PDF formatting issue in E-Mails

Please take a look at the uploaded invoice sample image. This is how it looks like. I
installed erpnext from scratch on centos 7 on 2 different machines and on Ubuntu
16.04. In both settings I got the same issue.

It happens when I’m sending the invoice per e-mail from the invoice section. (View the invoice in the preview mode and go to “Menu->E-Mail” ) If I open it direct in erpnext in the invoice section the PDF is generated correctly. (Menu → Print → PDF)

On the server I used the install script from GitHub - frappe/bench: CLI to manage Multi-tenant deployments for Frappe apps
and installed it with:

sudo python install.py --production

Did anyone get it to work correctly this days with the same install setting or has anyone the same issue.

Thanks Christoph K.

System installation:

Ubuntu: Ubuntu 16.04 Server x86_64

Installation configuration:

Locales: en_US.UTF-8

sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install python-minimal
sudo python install.py --production

First I configured the E-Mail domain
/desk#List/Email Domain/List

Second I configured

Now I’m ready for an invoice on
/desk#List/Sales Invoice/List

→ I created and saved the invoice

And now I have the menu und print buttons on the top right.

If I got to print (printer symbol) and then on PDF the PDF in the web browser is fine.

BUT if I go to “Menu → E-Mail” to send the invoice as E-Mail the formatting is lost.

Same problem if I go on “submit” and send the invoice to the customer’s e-mail address.

I checked it and installed the system multiple times. As mentioned before on Ubuntu and Centos. Is there really no one with this problem?

No one who is sending invoices per email from erpnext and has installed erpnext recently?

Or can anyone tell me where I can get help to this issue.

I would be really grateful for any help!


Can you please confirm that “Send Print as PDF” is checked in Setup => Print Settings?

Hi @christophK . You might want to take a look at this thread also link.

thanks so much for your help!
yes, “send print as pdf” is checked

Try adding host_name as shown here: PDF Email Problems Thread - #2 by saurabh6790

Thanks to you, creamdory and Sagar_Vora.

Adding the host_name to “frappe-bench/sites/site_name/site_config.json” was the solution.

vim frappe-bench/sites/site_name/site_config.json

“db_name”: db_name,
“db_password”: db_password,
“host_name”: “http://yourerpnextsite

Thanks so much, I had never thought the hostname in the “site_config.json” could have some effect on the pdf-invoice send per e-mail.

1 Like

I tried several options and for me only

“host_name”: “http://localhost:80

worked in site_config.json (although I did “bench set-url-root site1.local http://resolvable.site.name21” before).

erpnext version 10.1.72
frappe 10.1.63

I type this bench set-url-root site1.local http://erp.sp-globalindo.co.id and it fix all my printing email pdf error

1 Like

Hi , setting hostname on the site.config solves half of the problem for me, the email pdf option is at least able to retrieve images attached on the print form now, however it’s html and css is still inheriting its own .

Does anyone know how to make the email pdf use the CSS/HTML i supplied on the Print Format customization page?