[Development] Documentation for QPagedPrintDevice::setPageSize should specify a unit

Thomas Krenn thomas.krenn at kabsi.at
Tue Jun 7 10:26:27 CEST 2016


Hello,
Steve Schilz requested on Wed, 4 May 2016:

QPagedPrintDevice::setPageSize should specify a unit
QTextDocument::setPageSize (http://doc.qt.io/qt-5/qtextdocument.html#pageSize-prop)

---

Looking at the source code and the generated PDF's my conclusion is
is that the numbers of the property pageSize dependent on the platform
because all internal calculations of QTextDocument are done with: 'qt_defaultDpi'

Notably on Windows (qt_defaultDpi = 96 dpi) the produced PDF is to small
with a pageSize e.g.:

fullRectPoints  595 / 842  (595,44) / (841,62)     (72 dpi / A4)
and a PDF printer with:

     QString pdfName("hello.pdf")
     QPrinter printer(QPrinter::HighResolution);
     printer.setOutputFormat(QPrinter::PdfFormat);
     printer.setOutputFileName(pdfName);

     printer.setResolution(1200);
     QPageSize pageSizeA(QPageSize::A4);
     printer.setPageSize(pageSizeA);

// setting the printer margin to 0 (or full page mode) is important to avoid PDF page scaling.
     QMarginsF margins(0, 0, 0, 0);
     printer.setPageMargins(margins);


Best regards
Thomas Krenn


-------------- next part --------------
A non-text attachment was scrubbed...
Name: thomas_krenn.vcf
Type: text/x-vcard
Size: 222 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20160607/7c6e7a14/attachment.vcf>


More information about the Development mailing list