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

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

      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);

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

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

              Created:
              Updated:

                There are no open Gerrit changes