Create PDF document of print formats on single click

Is there any way to serve the PDF document by making a single click? Like right now,we will load the appropriate document(stock entry) and click on print and then PDF.I just want a single click to generate PDF on click of button in document(stock entry) and i want separate button on each print formats, so when i click the particular button the PDF documents with particular print format should generate on single click.


Hi @Jyotigujjari Did you achieve this?

@ibalajib just add a custom button to the doctype you want to print . using js and after clicking the button redirect to another page with the pdf url . the url is the same when you generate a pdf . just insert the docname , the printformat name and all other parameters.

Could you please elaborate this or could you able to share some code? I have created a custom button and I’m struck.

Thanks in advance!!

@ibalajib try this code . change Item with your doctype name.

frappe.ui.form.on('Item', {
refresh(frm) {
 frm.add_custom_button(__("PDF"), function() {
    var url = """&format=Standard&no_letterhead=1&letterhead=No%20Letterhead&settings=%7B%7D&_lang=en";,'_blank');


you can change the parameters in the url , like the print format name .
you can also add a small dialog form to change these parameters . the process won’t be a single click but it’s much quicker than the print button .


Thank you so much @bahaou

This code works fine.

Here we create a button in the list view to print directly.