UE before load for the button, then use a client script that calls a suitelet with the N/render module.
set your template, add data using render.addCustomDataSource(), then render.renderAsPdf() to generate the pdf.
To show the pdf in the suitelet, set response to : response.writeFile({ file : render.renderAsPdf(), isInline : true });
isInline will determine whether the file will be downloaded or displayed.
If you want to send your file to a printer to have it automatically printed, then I would recommend using PrintNode - a restlet for calling that API should exist in the WMS bundle.