Quantcast
Channel: Jobs
Viewing all articles
Browse latest Browse all 18427

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

$
0
0
Hi, I had a little code in Qt4.8 used to make a pdf file with barcodes and to print in cards (like credit cards). When my pc died, I installed Qt5.0, adding printsupport and other few modification not related with QPrinter o QPainter. No problem to compile or run in Qt5, but the file output it’s diferent, (see the picture), making an invalid barcode. Well, can somebody tell me why the output differ between Qt4.8 and Qt5? Thanks in advance. 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(); The picture:

Viewing all articles
Browse latest Browse all 18427

Trending Articles