Results 1 to 5 of 5

Thread: [SOLVED] Using QPainter to Import JPG for PDF Report

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Join Date
    Feb 2006
    Location
    Jarrell, Texas, USA
    Posts
    70
    Thanks
    7
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: [SOLVED] Using QPainter to Import JPG for PDF Report

    PDFWriter.width() = 9583
    PDFWriter.height() = 13699

    Karl


    Added after 18 minutes:


    The scaling concept helped.
    Here's how I got a logo that looks appealing.
    I do not want the logo to consume more than a third of the width of the page nor a fifth of height.
    So I scaled using these values:

    Qt Code:
    1. // Scaled images
    2. quint32 iWidth = pdfWriter.width();
    3. quint32 iHeight = pdfWriter.height();
    4. QSize s(iWidth/3, iHeight/5);
    5. QPixmap pxScaledPic = pxPic.scaled(s, Qt::KeepAspectRatio, Qt::FastTransformation);
    6. painter.drawPixmap(0, iYPos, pxScaledPic.width(), pxScaledPic.height(), pxScaledPic);
    7. iYPos += pxScaledPic.height() + 250;
    To copy to clipboard, switch view to plain text mode 

    Thanks for the help.

    Karl
    Last edited by KaptainKarl; 20th October 2014 at 20:59.

Similar Threads

  1. Report library for QT
    By blackliteon in forum Qt Programming
    Replies: 5
    Last Post: 20th October 2014, 08:23
  2. Replies: 0
    Last Post: 17th November 2009, 20:59
  3. QT report
    By triperzz in forum Qt Programming
    Replies: 3
    Last Post: 25th February 2008, 17:58
  4. Crash report
    By Lele in forum Qt Programming
    Replies: 6
    Last Post: 10th October 2007, 09:50
  5. error report
    By Rekha in forum Newbie
    Replies: 1
    Last Post: 14th August 2006, 12:11

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.