Results 1 to 9 of 9

Thread: Printing a pixmap full page: strange behavior on Windows

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Genk, Belgium
    Posts
    36
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Printing a pixmap full page: strange behavior on Windows

    In my application I print a pixmap, full page. Under Linux this works fine, but on Windows, only part of the pixmap is printed, with a high zoom-in level.

    In attachment, both pdfs.

    The printing code fragment:

    Qt Code:
    1. QPixmap pixmapToPrint = window->GetImageGraphicsView()->PaintToPixmap();
    2. QPainter painter(GetPrinter());
    3. QSize size = pixmapToPrint->size();
    4. QRect viewport = painter.viewport();
    5.  
    6. qDebug() << "pixmap size: " << size; // output: QSize(382,393)
    7. qDebug() << "painter viewport: " << viewport; // output: QRect(0,0 4958x7016)
    8.  
    9. size.scale(viewport.size(), Qt::KeepAspectRatio);
    10. painter.setViewport(viewport.x(),viewport.y(),size.width(),size.height());
    11. painter.setWindow(pixmapToPrint->rect());
    12.  
    13. qDebug() << "corrected painter viewport: " << painter.viewport(); // output: QRect(0,0 4958x5100)
    14. qDebug() << "corrected painter window: " << painter.window(); // output: QRect(0,0 382x393)
    15.  
    16. painter.drawPixmap(0,0,*pixmapToPrint);
    To copy to clipboard, switch view to plain text mode 
    Attached Files Attached Files

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.