PDA

View Full Version : read pdf with qt



iskenderoguz
16th June 2014, 12:34
I used poppler to read pdf in my qt app. I want to merge poppler source code with my own source code because I do not to load any libraries. But poppler has thousands of c and h files and I can not achieve this. I always get errors when compile project. I want to only read pdf in my app nothing more. Is there any simple library for this? Or can I do this with qt?

Thanks.

ChrisW67
17th June 2014, 01:41
You could just build Poppler with static libraries and link against these rather than the dynamic libraries.

iskenderoguz
20th June 2014, 12:13
I compiled poppler statically. I added poppler library to my pro file:


#-------------------------------------------------
#
# Project created by QtCreator 2014-06-14T21:26:48
#
#-------------------------------------------------

QT += core gui
QT += sql

TARGET = project2
TEMPLATE = app

CONFIG += staticlibs
CONFIG += static

SOURCES += main.cpp\
project.cpp

HEADERS += project.h

FORMS += project.ui

LIBS += /usr/lib/libpoppler-qt4.so


When I add .so file my app works. But if I add .a file my app does not work.



LIBS += /usr/lib/libpoppler-qt4.a


Errors are :


/usr/lib/libpoppler-qt4.a(poppler-document.o):-1: In function `Poppler::DocumentData::setPaperColor(QColor const&)':
/home/eee/Desktop/poppler-0.8.7/qt4/src/poppler-private.h:230: error: undefined reference to `SplashOutputDev::setPaperColor(unsigned char*)'
/usr/lib/libpoppler-qt4.a(poppler-document.o):-1: In function `Poppler::DocumentData::getOutputDev()':
/home/eee/Desktop/poppler-0.8.7/qt4/src/poppler-private.h:141: error: undefined reference to `SplashOutputDev::startDoc(XRef*)'
/usr/lib/libpoppler-qt4.a(poppler-document.o):-1: In function `Poppler::Document::linkDestination(QString const&)':
...