code: def print_file(self):
          
          editor = self.get_current_editor()
          filename = self.get_current_filename()
          printer = Printer(mode=QPrinter.HighResolution,
                            header_font=self.get_plugin_font('printer_header'))
          printDialog = QPrintDialog(printer, editor)
          if editor.has_selected_text():
              printDialog.setOption(QAbstractPrintDialog.PrintSelection, True)
          self.redirect_stdio.emit(False)
          answer = printDialog.exec_()
          self.redirect_stdio.emit(True)
          if answer == QDialog.Accepted:
              self.starting_long_process(_("Printing..."))
              printer.setDocName(filename)
              editor.print_(printer)
              self.ending_long_process()
docs: Print current file