How i did this button one call print format one and button two call print format two

i want to add many buttons and each one call specific print format
how could i did this?

Hii @manal_erpnext

button onclick event you can perform this for opening specific print format :

let print_format = "Payment Receipt";
                  let url = frappe.urllib.get_full_url(
                    `/api/method/frappe.utils.print_format.download_pdf?doctype=${encodeURIComponent(
                      frm.doc.doctype
                    )}&name=${encodeURIComponent(
                      frm.doc.name
                    )}&format=${encodeURIComponent(
                      print_format
                    )}&no_letterhead=0`
                  );
                  window.open(url, "_blank");

I hope this works for you.

1 Like

i do not want pdf
i want in print view
@Manav_Mandli
image

for redirecting specific print format i am not sure how to achive but please check once i hope this works for you

@Manav_Mandli this did not work with me