Creating a custom PDF

If I want to create a PDF on the fly, like say, give a custom button on the doctype which when clicked will generate a PDF and download it locally on the user’s machine, how do I do that?

I would ideally want to piggyback on Frappe’s PDF generation capabilities, but control the content that goes into the PDF.

What are the api’s client side and server side to do that?

You will have to create a Print Format. See frappe/print_format.py at develop · frappe/frappe · GitHub

@rmehta, looks pretty good. Will explore this further.

Just one more question, can I also use to extend this to replace the print option in the doctype standard menu so this print format is shown?