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

Difference between Qt4.8 and Qt5.0 when print pdf

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • 5.1.1
    • 5.0.1
    • GUI: Painting
    • None
    • Windows XP, Qt5.0.1, MinGW 4.7
    • a4478b28966c5f630ba3d93b97bc91a3cec2fdbe

    Description

      Diference between pdf generation using Qt4.8 and Qt5.0.1, printing barcode 3 of 9 using basically same code.
      The code

      mm = 11.8;
      QPrinter printer;
      QStringList path = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation);
      QString home = QFileInfo(path.at(0)).absoluteFilePath();

      QDateTime fecha;
      QString tarjFile = tr("tarjetas_%1.pdf").arg(fecha.currentMSecsSinceEpoch());
      QString outputPdf = tr("%1/%2").arg(home).arg(tarjFile);

      printer.setOutputFileName(outputPdf);
      printer.setOutputFormat(QPrinter::PdfFormat);
      printer.setPaperSize(QSize(85.6, 54), QPrinter::Millimeter);
      printer.setResolution(300);
      printer.setColorMode(QPrinter::Color);
      printer.setPageMargins(0.0, 0.0, 0.0, 0.0, QPrinter::Millimeter);
      printer.setFontEmbeddingEnabled(true);

      QPainter painter;
      painter.begin(&printer);
      QFont fontC("3 of 9 Barcode", 16);

      tarjeta = ("1234567890123456");
      painter.drawText(QRect(0, 5*mm, 85.6*mm, 5*mm), Qt::AlignHCenter, tarjeta);
      painter.end();

      A picture with diference:

      Barcode generated with Qt4.8; it works, with Qt5: it dosn't works (when I say "it works", is: the bardcode reader can read it and decode).

      Barcode tested on LibreOffice, it works:

      One of fonts tested: http://www.dafont.com/3of9-barcode.font

      I tried with several fonts, using directly from windows's (xp) fonts and adding with QFontDatabase::addApplicationFont(). Same result.

      Attachments

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

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            sergiodanielg Sergio Daniel Gomez
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes