Qt World Summit: Register Today!

Use poppler library WITH QML not C++?

  • Hey guys,

    New to QML and want to use the poppler library to display and edit PDF`s from QML. Now most of the documentation (that is scattered across the www) it seems everything is pointing to that the poppler library can only be used from C++ code. Is that true?

    Now i have installed the poppler-0.73.0 library successfully and i import it in my .pro file without issues. But i really would like to write everything inside QML instead. Now another way is to use KDE´s Okular, but was hoping not to have to do that.

    Any help to how i can use Poppler from QML would be awsome!
    I`m btw using Macos High Sierra 10.13.x

  • Moderators

    Since poppler doesn't provide QML types, you will need to bring it to QML yourself.
    For example read this and this as a starting point.

    For displaying images from C++ in QML you need to create a simple QQuickImageProvider.
    Editing is a whole different feature. How should the editing exactly happen?
    Do you want to resize each element individually?
    What element types (text, images, vector graphics, etc.)?

    This is by far not trivial to implement.

    You will need to map each element/info/... you get out of poppler to a corresponding QML item and vice versa.

  • @raven-worx I was hoping to be able to "paint" som simple vector graphics on top of the pdf resizing each individually yes and then saving it for print. You are completely right it is not trivial at all to implement.

    Thanks for the info on integrating C++ with QML, will look into this the next days.

Log in to reply