Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QWebEngineView to view local pdf at certain page



  • I set a url to the webengineview and it works fine but the page argument is ignored:

    QUrl url(QUrl::fromLocal(pdfPath));
    url.setFragment("page=3")
    webView.setUrl(url);
    

    I've tried this with online pdfs as well. I see this in the application output:

    [5852:7404:0423/101833.779:ERROR:extension_function_dispatcher.cc(487)] Permission denied for metricsPrivate.recordValue
    js: Unchecked runtime.lastError: Access to extension API denied.
    js: Uncaught (in promise) TypeError: Cannot read property 'getStrings' of undefined
    js: Uncaught Error: Assertion failed

    Is this just not supported? I'm using MSVC 2019 and Qt 5.15.2

    edit:
    I've also tried via js:

    webView->page()->runJavaScript(QString("window.viewer.viewport_.goToPage(3)"));
    

    and received this message:
    js: Uncaught TypeError: Cannot read property 'viewport_' of null

    on the loadFinished(bool ok) slot I used a single shot timer which is sometimes needed when js is loading but even up to 5 seconds I still get the same message


Log in to reply