Tuesday, June 14, 2011

Building Poppler Qt4 Wrapper

Poppler is a PDF rendering library used by several programs (i.e. evince, Oular, LocoPDF, etc.) that comes with multiple frontends (APIs), including a Qt 4 wrapper. As I wanted to develop a PDF viewer for DFF (Digital Forensics Framework) I decided to build latest Poppler version from scratch under Linux. Here are some notes I collected from such a task.

I found that esentially you need to set several environment variables before configuring Poppler and building the Qt 4 wrapper. Assuming you downloaded the latest source files, untar it and set the required environment variables, see example below:

pablo@ubuntu:~/projects/poppler-0.17.1$ tar zxvf poppler-0.17.1.tar.gz
pablo@ubuntu:~/projects/poppler-0.17.1$ cd poppler-0.17.1
pablo@ubuntu:~/projects/poppler-0.17.1$ export POPPLER_QT4_CFLAGS=-I$QTDIR/include
pablo@ubuntu:~/projects/poppler-0.17.1$ export POPPLER_QT4_CXXFLAGS=-I$QTDIR/include
pablo@ubuntu:~/projects/poppler-0.17.1$ export POPPLER_QT4_LIBS=-L$QTDIR/lib -lQtCore -lQtGui -lQtXml
pablo@ubuntu:~/projects/poppler-0.17.1$ export POPPLER_QT4_TEST_CFLAGS=-I$QTDIR/include
pablo@ubuntu:~/projects/poppler-0.17.1$ export POPPLER_QT4_TEST_LIBS=-L$QTDIR/lib -lQtCore -lQtGui -lQtXml
pablo@ubuntu:~/projects/poppler-0.17.1$ ./configure --enable-poppler-qt4
pablo@ubuntu:~/projects/poppler-0.17.1$ make
pablo@ubuntu:~/projects/poppler-0.17.1$ sudo make install

so you'll end up with the Poppler Qt 4 wrapper library and headers installed under /usr/local/lib and /usr/local/include/poppler/qt4 respectively.

You can even try building and running an example from Qt Quartely provided here.

Cheers.

1 comment: