Download Report PDF from Website

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

1 Like

Anyone?

This may interest you Does erpnext have an event/ticketing module? (like odoo or eventbrite) - #4 by pee

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.

3 Likes

Hello,

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

Thanks,
Vamyip

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

Good Day

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