I find the best way to download doctype’s pdf file on my local machine. Is exist any way to do it?
I have my part of code:
for item in items: url = "http://" + frappe.request.host + "/api/method/frappe.utils.print_format.download_pdf?doctype=Certificate&name=" + \ item['name'] + \ "&format=New Horizons Certificate&no_letterhead=0" doc = get_pdf(url) with open('file.pdf','wb') as file: file.write(doc)
When I opened my “file.pdf” as html page, I got error:
How I can download pdf file on my server? Is it correct way or what I make wrong?