Print Button For Single Doctype

i have created single doctype named Despatch Labels, but this doctype don’t have print button

how to enable it anyone knows ?

I think for Single Doctype there is no options to print

Did you get any solution ?

i write client script for it and working fine
@Antony_Praveenkumar do you need script ?

Yes please share here @nilpatel42

frappe.ui.form.on('Doctype_Name', {
    refresh: function(frm) {
        frm.add_custom_button(__('Print'), function() {
            navigateToPrintFormatUI(frm);
        });
    }
});

function navigateToPrintFormatUI(frm) {
    var docName = frm.doc.name;

    var doctype = 'Doctype_Name';

    var printFormatUrl = `/app/print/${encodeURIComponent(doctype)}/${encodeURIComponent(docName)}`;

    window.location.href = frappe.urllib.get_full_url(printFormatUrl);
}

please give me the reply if code not working
thank you

If you press the Ctrl + P its directly take you to the Print Page. I hope this may help even more better.

1 Like

that shortcut is printing a page which you viewing, i have barcode printer and my sticker size is 50 x 100 mm, that’s why i make print format according my requirement and make print only those field which i want print

thank for suggestion @Antony_Praveenkumar

1 Like