Function "get_pdf" from server script

Hey everyone,
how I can I reach get_pdf function from server script, please?

Standard call frappe.utils.pdf.get_pdf() unfortunately returns: TypeError: 'NoneType' object is not callable

image

I have found workaround: frappe.call('frappe.utils.print_format.report_to_pdf', html = body)
and the the result is saved here: frappe.response.filecontent

But this method makes an error on the client site:

image

This error interrupts the saving, reloading, etc. of the current doc and it is not good :frowning:

Thanks for any advice in advance.
Jiří Šír

Hello,
finally, I have found the solution with noticed workaround:

I have used:

frappe.call('frappe.utils.print_format.report_to_pdf', html = body)     
content = frappe.response.filecontent #content to store
frappe.response.type = "" #the solution for xhr problem in browser

Jirka

2 Likes