I have a list with an InfoPath form published to it. I have a request to have a print button functionality added.
I have seen that on Form Libraries this was doable but how about a List Form?
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.
Sign up to join this communityI think you cannot have code for List form instead we can have for Library form.
but you can try to
function printInfoPathForm(){
var ipForm = $(INFOPATH_FORM);
if (ipForm) {
//build html for print page
var html = "<HTML><HEAD>\n"+
$("head").html()+
"</HEAD>\n<BODY>\n"+
ipForm.html()+
"\n</BODY></HTML>";
//open new window
var printWP = window.open("","printWebPart");
printWP.document.open();
//insert content
printWP.document.write(html);
printWP.document.close();
//open print dialog
printWP.print();
}
}
You can also check