How to generate PDF with frappe.get_print()

I want to generate pdf with specified format in custom app for sending it to whatsapp or telegram like email have pdf attachment

any one have example how to use it ?

I Tried with this, PDF Download Working, but i am not able send it to the Whatsapp or any other app

frappe.ui.form.on('Price', {
    refresh: function(frm) {

        frm.add_custom_button(__('Download Price PDF'), function() {

            let site_base_url = window.location.origin;
            let doctype = encodeURIComponent(frm.doctype);
            let name = encodeURIComponent(;
            let print_format_name = 'Print Format Name'; 
            let url = `${site_base_url}/api/method/frappe.utils.print_format.download_pdf?doctype=${doctype}&name=${name}&format=${print_format_name}&no_letterhead=0`;

            let link = document.createElement('a');
            link.href = url;
   = `${name}.pdf`; /
        }, __('Actions'));