using Poppler Qt4 c++

6.8k views Asked by At

i need a pdf viewer library to be used in my app, am using c++ and QT

i downloaded Poppler and code example The Poppler Qt4 interface library but, i do not know how to configure the library to work in my code. i am using QT Creater, in windows xp.

thanks in advance, any hint is appreciated as am completely lost.

1

There are 1 answers

0
serge_gubenko On

assuming you've installed poppler headers and libraries on your system correctly. I'm on ubuntu, and running:

./configure
make
make install

made poppler libraries built and installed. From my understanding you can use msys/mingw on windows to something similar to this.

Now in your .pro file add following lines:

INCLUDEPATH += /path_to_poppler_include_files/qt4
LIBS += -L/path_to_poppler_libs -lpoppler-qt4

and the code like this:

#include <poppler-qt4.h>

....

QString filename;

Poppler::Document* document = Poppler::Document::load(filename);
if (!document || document->isLocked())
{
    // ... 
    delete document;
}

should build and run for you.

hope this helps, regards