Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QtWebEngine
  4. QWebEngineView to view local pdf at certain page
Qt 6.11 is out! See what's new in the release blog

QWebEngineView to view local pdf at certain page

Scheduled Pinned Locked Moved Unsolved QtWebEngine
1 Posts 1 Posters 1.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kazaak
    wrote on last edited by kazaak
    #1

    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

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved