Wrong scaling on printing QWebView
Unsolved
General and Desktop
-
Hello all,
i have a QWebView loading PDF.js with an pdf file, this works fine. But when i try to print the pdf file, the page have a wrong scaling. The print have a lot of white space on the bottom and on the right.
I discovered, that it depends on the window size. So if i reduce the window size, the white space on the print output changes.
Here is some code:
//Loading PDFjs with PDF QUrl viewer = QUrl::fromLocalFile(QFileInfo("pdfjs/web/viewer.html").absoluteFilePath()); this->ui->webView->load(viewer.url() + "?file=../../files/pdffile.pdf"); // Printing QPrinter printer; printer.setFullPage(true); QPrintDialog* pd = new QPrintDialog(&printer, this); if(pd->exec() == QDialog::Accepted) { this->ui->webView->print(&printer); }
I also tried to prepare document for printing with
this->ui->webView->page()->mainFrame()->evaluateJavaScript("window.print();");
But than output is completely blank ... idk whats wrong with that :o
What am i doing wrong?
Thanks in advanced :)