5
votes

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
i edited the code. #include <poppler-qt4.h>code. with the correct path of the header file. currently i have this error in QT creator ":: error: cannot find -lpoppler-qt4".nemo

1 Answers

5
votes

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