How to display pages with poppler



  • I'm trying to make a Document Viewer and i'm kinda stuck. I'm using poppler lib. I can open PDFs, and view a single page(the page number that is passed to poppler page function), by rendering it to Qimage and displaying it using a QLable. How can i display all pages, and how can i make continious view mode?



  • Hi chronix,
    you have to implement this by yourselfe.
    You can ask the poppler document for the number of pages
    the pdf includes and render every page to an image.
    Then you need to implement some kind of page switching, like
    pressing the right arrow key to display the next page in your label.
    Poppler only gives you the ability to render pages or search for text, aso.
    You have to build the viewer part arround this.



  • Yeah, i understand that, i get the whole concept, but i stuck with the implimentation part. I'll try and figure it out. Thanks for you reply.



  • One approach I made, was to use a QGraphicsView. To display the pages I used QGraphicsPixmapItem. Then I reimplemented the ViewportEvent of the QGraphicsView to move the pages in the QGraphicsPixmapItems on mouse wheel to get a scrolling effect.


  • Lifetime Qt Champion

    Hi,

    Isn't that article from Qt Quarterly what you are looking for ?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.