Results 1 to 11 of 11

Thread: [SOLVED] Print to pdf

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts

    Default Re: Print to pdf

    Do you paint anything? See QPainter::drawImage().
    For example:
    Qt Code:
    1. painter.drawImage(0,0,qi);
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  2. #2
    Join Date
    Jan 2006
    Posts
    976
    Qt products
    Qt3
    Platforms
    Windows
    Thanks
    53

    Default Re: Print to pdf

    I tried this but print nothing again....
    Qt Code:
    1. qi.save(base_file + ".png","PNG");
    2. QPrinter printer(QPrinter::HighResolution);
    3. printer.setFullPage( TRUE );
    4. printer.setPageSize(QPrinter::A4);
    5. if ( printer.setup(this) ) { // printer dialog
    6. statusBar()->message( "Printing..." );
    7. QPainter painter;
    8. painter.drawImage(0,0,qi, 10,10, 20,20);
    9. if( !painter.begin( &printer ) ) { // paint on printer
    10. statusBar()->message( "Printing aborted", 2000 );
    11. return;
    12. }
    13.  
    14. painter.end();
    15. statusBar()->message("");
    16. }
    To copy to clipboard, switch view to plain text mode 
    Regards

Similar Threads

  1. Trouble to print with QPrintPreviewWidget
    By estanisgeyer in forum Qt Programming
    Replies: 5
    Last Post: 24th December 2009, 06:14
  2. QSqlQuery and seek() - doesn't work on first call.
    By amicitas in forum Qt Programming
    Replies: 1
    Last Post: 2nd October 2008, 17:25
  3. Change margin on QTextEdit print()
    By Dii in forum Qt Programming
    Replies: 2
    Last Post: 20th May 2008, 22:45
  4. print QTableWidget
    By chak_med in forum Qt Programming
    Replies: 3
    Last Post: 4th November 2006, 18:46
  5. [QT4] QThread and printing a QList<QPixmap>
    By KShots in forum Qt Programming
    Replies: 3
    Last Post: 24th April 2006, 21:44

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
  •  
Qt is a trademark of The Qt Company.