Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using Poppler Qt4 c++

Tags:

c++

pdf

qt

poppler

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.

like image 374
nemo Avatar asked Feb 27 '11 19:02

nemo


1 Answers

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

like image 52
serge_gubenko Avatar answered Sep 24 '22 15:09

serge_gubenko