Wrong scaling on printing QWebView

  • 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;
    QPrintDialog* pd = new QPrintDialog(&printer, this);
    if(pd->exec() == QDialog::Accepted) {

    I also tried to prepare document for printing with


    But than output is completely blank ... idk whats wrong with that :o

    What am i doing wrong?
    Thanks in advanced :)

Log in to reply