Results 1 to 2 of 2

Thread: How to print in a native format using Qprinter

  1. #1
    Join Date
    Sep 2009
    Posts
    54
    Thanks
    4
    Thanked 3 Times in 3 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default How to print in a native format using Qprinter

    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 

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: How to print in a native format using Qprinter

    The native format on your system probably postscript.

    Do you have the necessary postscript libraries installed?

Similar Threads

  1. Replies: 1
    Last Post: 7th July 2009, 16:46
  2. Replies: 1
    Last Post: 5th July 2009, 10:10
  3. QGraphicsScene print ? or to pdf format?
    By patrik08 in forum Qt Programming
    Replies: 3
    Last Post: 15th July 2007, 23:37
  4. QPrinter::PdfFormat html format && Link
    By patrik08 in forum Qt Programming
    Replies: 2
    Last Post: 8th April 2007, 12:37
  5. QPrinter does not print anything
    By gould75 in forum Qt Programming
    Replies: 0
    Last Post: 22nd August 2006, 18:34

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.