Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to Open pdf in QtWebview or QML in general ?
Qt 6.11 is out! See what's new in the release blog

How to Open pdf in QtWebview or QML in general ?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 2 Posters 3.6k Views 2 Watching
  • 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.
  • QjayQ Offline
    QjayQ Offline
    Qjay
    wrote on last edited by
    #1

    Hey how can i open pdf in Qtwebview ?

    I have a url which has pdf for ex this url : http://www.tutorialspoint.com/java/java_tutorial.pdf

    Qtwebview does not open that url .

    IS there any other way to open pdf in QML ?

    1 Reply Last reply
    0
    • sneubertS Offline
      sneubertS Offline
      sneubert
      wrote on last edited by
      #2

      Either get https://github.com/qt-labs/qtpdf
      or https://poppler.freedesktop.org/ (there´s a qt5 interface)
      both can render to QImage

      1 Reply Last reply
      1
      • QjayQ Offline
        QjayQ Offline
        Qjay
        wrote on last edited by
        #3

        how can i add it to my project ? is it possible to do it with just qml ?

        1 Reply Last reply
        0
        • sneubertS Offline
          sneubertS Offline
          sneubert
          wrote on last edited by
          #4

          For poppler, most major linux dists are providing devel packages so you can #include <poppler-qt5.h> and add LIBS += -lpoppler-qt5 to your .pro file. If precompiled poppler (e.g. Windows) is not available, you have to build it from source.

          For qtpdf, build qpdf.pro (qmake, make, make install) , add QT += pdf and #include <QPdfDocument> in your source.

          Take a look at the build instruction and examples of each project.

          1 Reply Last reply
          3

          • Login

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