Results 1 to 17 of 17

Thread: Why QPrinter always generates PDF docs with the same size?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Catalonia
    Posts
    266
    Thanks
    44
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Thumbs up Why QPrinter always generates PDF docs with the same size?

    Hi, I need to use QPrinter to generate a PDF doc with several images (one image for page). I use the code below to generate a PDF doc with one image in one page, the problem is that the size of the resulting doc is extremely big (7 MB ). I've tried to set the resolution to the minimum resolution (72dpi) that supports the printer driver (PDFCreator) and the printer mode to "ScreenResolution" but it doesn't works. I also have tried to set to the maximum compresion of images in PDFCreator but it neither works. Very strange. Somebody could suggest me something else? Thanks.

    Qt Code:
    1. int main(int argc, char *argv[])
    2. {
    3. QApplication a(argc, argv);
    4.  
    5. QPrinter printer(QPrinter::ScreenResolution);
    6. printer.setResolution(72);
    7. printer.setOutputFormat(QPrinter::PdfFormat);
    8. printer.setOutputFileName("../test.pdf");
    9. printer.setFullPage( TRUE );
    10. printer.setPageSize(QPrinter::A4);
    11. printer.setOrientation(QPrinter::Landscape);
    12.  
    13. QPainter painter;
    14. painter.begin(&printer);
    15. painter.drawImage(printer.pageRect(), QImage("../proba.jpg");
    16. painter.end();
    17.  
    18. return 0;
    19. }
    To copy to clipboard, switch view to plain text mode 

    PD: The original size of the test image ("proba.jpg") is 3368x2440 pix and it's in grayscale. But I also have tried to set the colorMode of the printer to graysCale but the resulting size is always the same
    Last edited by SkripT; 21st April 2006 at 10:09.

Similar Threads

  1. Qt 4.1.1 linker warnings
    By Matt Smith in forum Installation and Deployment
    Replies: 0
    Last Post: 26th February 2006, 22:14

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.