ERPNext Conference 2019* ERPNext.com Blog

Download Report PDF from Website

wkhtmltopdf
customization
report

#1

Hello,

I have a doctype which stores passes for Events and want attendees to be able to download passes in PDF format. I’ve designed a script report and custom print format for the same.

I want to make a website page, where attendee can enter two fields (for authentication) and hit submit to download his PDF.

How can we make a request to server with report parameters to directly get pdf as response? Are there any alternate ways to get the pdf?

Thanks,
Vamyip


#2

Anyone?


#3

This may interest you Does erpnext have an event/ticketing module? (like odoo or eventbrite)


#4

The URL to generate a PDF for any doc in Frappe/ERPNext is:

http://site.local:8000/api/method/frappe.utils.print_format.download_pdf?doctype={doctype}&name={name}&format={print_format_name}&no_letterhead=0

Where you can specify the doctype, name and the print format name to generate it’s PDF.


#5

Hello,

I’ll try both options and revert back which one worked for me.

Thanks,
Vamyip


#6

I went partly with suggestion of @netchampfaris.

It seems to be working good so far.
Steps:

  1. Create a website page
  2. Create a whitelisted method with (allow_guest=True)
  3. copied some lines of code which were written to generate pdf in frappe.utils.print_format.download_pdf with some additional logic to log this activity.
  4. Allowed Doc Permissions for Guest User

Thats it!

Regards,
Vamyip


#7

Good Day

If i run this in backend (php) will downloaded file be downloaded in backend?