ERPNext Conference 2019* Blog

Downloading PDF Files by REST API is it good decison?


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://" + + "/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:

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?


Good Day

I also looking for backend mine in php to download pdf and download to user pc.
Did you manage to get this working?