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


<<attachment: thomas_krenn.vcf>>

_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to