PDF Email Problems Thread

I updated my ERPNEXT to the lastest version, 7.1.0… and voila! it works!

Can Frappe team confirm if there have been improvements in this area? Noted prior discussion on switching to jphantom - Replace wkhtmltopdf to phantomjs? - cannot see it as an enhancement against v7.1 though…

Unfortunately cannot simply upgrade given it is not stable release. Hopefully when the time comes it will resolve.

HI,
I am still stack. Here is my .json file. What I missed please let me know.
{
“db_name”: “secret”,
“db_password”: “secret”,
“developer_mode”: 1,
“host_name”: “http://my.host.name
}

Hi,
Even after changing the json files with the above said addition of
“host_name”:“http://localhost:8080”, the pdf is losing its formatting when sending it via mail.
Is there any other solution?

Thanks and regards
Ajit

pls try on “host_name”:“http://localhost:80

1 Like

Hi,
Thanks, the formatting of the PDF is retained, but the font styles are lost.

this works fine on VM hosted
thanks.

I also have same issue after upgrading v8
I tried this solution but failed

recently updated to the latest version, and i am losing the formatting in pdf even after adding "host_name" : "http://localhost:80", to the sites_config.json.

If i remove the above line, the PDF gets timed-out.

@helpdesk
could you please help me regarding the pdf issue above.!

Awaiting your response.

Thanks

Hi Ajit,

Please rename the “localhost” with the system name .

hi,

Still no change

observe the screenshot attached - the images are lost

PDF version

actual version what is expected

My site_config.json file

I don’t think it’s a good idea to publish you db passwd on the web!

I’m not sure but your hostname is specified with the https prefix, shouldn’t the port be 443 in that case?

@Bas_de_Reus Thanks for letting me know about the password.

I corrected the https prefix, still no change in pdf output

Ok weird thing.
But the PDF problem does not actually seem to be a problem.

When clicking on PDF in the print view, it gets timed out and doesnt open the pdf page, but the same thing if it is directly sent as a mail, gets delivered with the proper format.

Not sure if I should raise this as an issue or not.!

Hi @ajit.jain1,

I have seen such issues before for two reasons:

  • Not enough server memory available
  • Missing images (for example after a change from public to private)

In both cases the PDF was generated when sent via email but not directly in the browser.

After correction of the underlying issue, I have not encountered any further problem.

Maybe that can help you.

2 Likes

HI @chdecultot,

  • How much memory is required?
  • And what do you mean by missing images? did not understand this. can you explain a little.

Thanks and regards
Ajit

Hi,

Regarding memory, I would say at least 2GB (works sometimes with less but it’s risky).

In some cases, the user was selecting an item that had an image with a broken link. I guess, due to a change from private to public.
It caused a server timeout.

You can check broken links by going in the items list and viewing only the associated images. They should all be displayed.

Don’t hesitate to also check your logs, you will find the root cause of the error (Frappe + MariaDB logs).

“attachments”: [],
“cc”: [],
“communication_name”: “ee6443f587”,
“lang”: “en”,
“print_format”: “Standard”,
“print_html”: “”,
“recipients”: [
satish@swirlocean.com
]
}
Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/communication/email.py”, line 435, in sendmail
recipients=recipients, cc=cc)
File “/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/communication/communication.py”, line 209, in _notify
_notify(self, print_html, print_format, attachments, recipients, cc)
File “/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/communication/email.py”, line 141, in _notify
prepare_to_notify(doc, print_html, print_format, attachments)
File “/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/communication/email.py”, line 251, in prepare_to_notify
print_format=print_format, html=print_html))
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 1262, in attach_print
“fcontent”: get_print(doctype, name, print_format=print_format, style=style, html=html, as_pdf=True, doc=doc)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 1245, in get_print
return get_pdf(html, output = output)
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/pdf.py”, line 17, in get_pdf
pdfkit.from_string(html, fname, options=options or {})
File “/home/frappe/frappe-bench/env/src/pdfkit/pdfkit/api.py”, line 68, in from_string
return r.to_pdf(output_path)
File “/home/frappe/frappe-bench/env/src/pdfkit/pdfkit/pdfkit.py”, line 140, in to_pdf
raise IOError(‘wkhtmltopdf reported an error:\n’ + stderr.decode(‘utf-8’))
IOError: wkhtmltopdf reported an error:
Exit with code 1 due to network error: HostNotFoundError

Getting this issue please help

@umair Sir, any solution on this?