PDA

View Full Version : How to print in a native format using Qprinter



Askar
18th September 2010, 11:20
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
QTextEdit *editor = static_cast<QTextEdit*>(letters->currentWidget());
//! [18]
QPrinter printer;
printer.setOutputFormat(QPrinter::NativeFormat);
printer.setPrintProgram("lpr");
QPrintDialog *dialog = new QPrintDialog(&printer, this);
dialog->setWindowTitle(tr("Print Document"));
dialog->
if (editor->textCursor().hasSelection())
dialog->addEnabledOption(QAbstractPrintDialog::PrintSelect ion);
if (dialog->exec() != QDialog::Accepted)
return;
//! [18]
editor->print(&printer);

tbscope
18th September 2010, 12:31
The native format on your system probably postscript.

Do you have the necessary postscript libraries installed?