Error printing on page (qtWebkit)

Error in Qt5.2.1:

The only problem was fixed in QPrintPreviewDialog , but when printing is printed on paper, the error still exists.

With QPrintPreviewDialog pages work flawlessly, but on the "paper" (printed on paper) from the second page (in other words, all pages except the first one happen with an error) the "texts" and "images" (without the background) disappear (apparently an error occurs with inline elements only).

See: https://bugreports.qt.io/browse/QTBUG-37240 (see attachments to the test file)


Error in Qt5.0.1, Qt5.0.2 and Qt5.1.0

The first page of a QWebView listing with small fonts and images.

Apparently, the problem arises only with inline elements (texts and images).

Note. The error occurs in Windows XP, Windows 7, Window 7 x64, Mac OS X 10.8.3

[edit]

Source-html: http://jsfiddle.net/bdm6Y/2/

Frame Contents: http://jsfiddle.net/bdm6Y/2/show/

Errorprint

A source:

 QPrinter p; p.setPaperSize(QPrinter::A4); p.setFullPage(true); p.setResolution(300); p.setOrientation(QPrinter::Portrait); QPrintPreviewDialog preview(&p); preview.setWindowTitle(ui->myWebView->page()->mainFrame()->title()); connect(&preview, SIGNAL(paintRequested(QPrinter*)), this, SLOT(printPreview(QPrinter*))); preview.exec(); ... void printPreview(QPrinter *printer) { ui->myWebView->print(printer); } 

I do not know if this is a mistake or something I did wrong, what could it be?

Thanks!

[edit]

QT Error Reporting:

https://bugreports.qt.io/browse/QTBUG-30621

+6
source share
1 answer

The problem is fixed in Qt5.3

Qt 5.3 Print Support

  • The new QPA class QPlatformPrintDevice for the abstract hardware of the printing device, new implementations for Windows, Mac and Linux.
  • QPrinterInfo provides more detailed information about the hardware of the print device. A.
  • QPrinter uses QPageSize and QPageLayout to improve page layout processing.
  • QPrinter has the behavior of most functions standardized on all platforms (as described below)
  • A Mac can now have each colored page with a different orientation and can set up associated copies and document name.
  • Mac and Windows now support Document Creator and Duplex Mode settings
  • Mac and Linux now support the use of the Windows Page ID (DMPAPER values)
  • Linux now requires CUPS 1.4 (RHEL 5 is no longer supported)

Code tested on Windows:

 QPrinter print(QPrinter::HighResolution); print.setPageMargins(qreal(1), qreal(1), qreal(1), qreal(1), QPrinter::Millimeter); print.setPaperSize(QPagedPaintDevice::A4); QPrintPreviewDialog pd(&print, mwindow, Qt::Window); QObject::connect(&pd, SIGNAL(paintRequested(QPrinter *)), this, SLOT(preview(QPrinter *))); if(pd.exec() == QPrintPreviewDialog::Accepted) { /*something*/ } ... void MainWindow::preview(QPrinter* p) { mframe->print(p);//mframe is an QWebFrame } 
0
source

Source: https://habr.com/ru/post/946294/


All Articles