Here is a link to code that does just this, and it shows you the necessary steps to configure client side if needed.
Just a caveat though: There are are a few reasons why it might not be a good idea though
The user might want to choose which printer to use, as well as choose settings like gray scale and paper size etc.
This might be abused to print popups and advertisements
I hope this helps you