Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-16286

Printing QTextDocument with pictures via QPrinter as PDF will result in very big files.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4: Low
    • None
    • 4.7.1
    • GUI: Printing
    • None

    Description

      Hello,
      when I creating and print an QTextDocument with pictures, witch are stored in the resource system to PDF. the resulting PDF file are very lage. 2 JPEG files with 220kb together will result in an PDF file with 600KB.
      Sample:
      QPrinter *printer=new QPrinter();
      printer->setOutputFormat(QPrinter::PdfFormat);
      printer->setPaperSize(QPrinter::A4);
      printer->setOutputFileName(/tmp/foo.pdf");
      printer->setColorMode(QPrinter::Color);
      QTextDocument *doc=new QTextDocument();
      doc->setPageSize(printer->paperSize(QPrinter::Millimeter));
      QTextCursor cursor(doc);
      QTextImageFormat picture1;
      picture1.setName(":/picture/top.jpg");
      picture1.setWidth(150);
      cursor.insertImage(picture1,QTextFrameFormat::FloatLeft);
      QTextImageFormat picture2;
      picture2.setName(":/picture/right.jpg");
      picture2.setWidth(45);
      cursor.insertImage(picture2,QTextFrameFormat::FloatRight);
      doc->print(printer);

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              Unassigned Unassigned
              tuxmaster Frank Büttner
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes