Problem with printing if "windows scaling" > 100%



  • Hi, for example:

    	QPrinter printer(QPrinter::HighResolution);
    	printer.setOutputFormat(QPrinter::PdfFormat);
    	printer.setPageMargins(10, 0, 10, 0, QPrinter::Millimeter);
    	printer.setPaperSize(QPrinter::A4);
    	printer.setOutputFileName("testItems.pdf");
    	QTextDocument *doc = new QTextDocument(this);
    	doc->documentLayout()->setPaintDevice(&printer);
    	doc->setPageSize(QSizeF(QSize(printer.pageRect().size())));
    	printer.setFullPage(0);
    	doc->print(&printer);
    

    problem with printing result, after change "Windows display scaling" from 100%(different font size, cellspacing, etc(larger)). Any ideas how fix it?



  • Any advices?



  • solution

    	QApplication::setAttribute(Qt::AA_Use96Dpi);
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.