Dear Friends,
I am trying to print text using Qprinter, it gives error like this,

lpr: Unsupported format 'application/postscript'!

then i tried with setoutputformat() member, still gives same error can any body help me please,

code is
Qt Code:
  1. QTextEdit *editor = static_cast<QTextEdit*>(letters->currentWidget());
  2. //! [18]
  3. QPrinter printer;
  4. printer.setOutputFormat(QPrinter::NativeFormat);
  5. printer.setPrintProgram("lpr");
  6. QPrintDialog *dialog = new QPrintDialog(&printer, this);
  7. dialog->setWindowTitle(tr("Print Document"));
  8. dialog->
  9. if (editor->textCursor().hasSelection())
  10. dialog->addEnabledOption(QAbstractPrintDialog::PrintSelection);
  11. if (dialog->exec() != QDialog::Accepted)
  12. return;
  13. //! [18]
  14. editor->print(&printer);
To copy to clipboard, switch view to plain text mode