Printing a single type doctype

Is there a way to add a print button to a Single type doctype?

Yes my friend here is the code, change the doctype name, buttom name and print format name

    frappe.ui.form.on("Sales Invoice",{
    refresh: function(frm) {

frm.add_custom_button(__("Factura"), function() {
            var w ="/printview?doctype=Sales%20Invoice&name=" + + "&trigger_print=1&format=Matricial%20Ajustada&no_letterhead=0&_lang=es");

            if(!w) {
                frappe.msgprint(__("Please enable pop-ups")); return;

This works perfectly!
Thank you so much!