Probably this would be a good place to start:
http://doc.qt.io/qt-5/qprinter.html