使用Poppler Qt4 c ++

nem*_*emo 5 c++ pdf qt poppler

我需要一个pdf查看器库在我的应用程序中使用,我正在使用c ++和QT

我下载了Poppler 和代码示例Poppler Qt4接口库 但是,我不知道如何配置库以在我的代码中工作.我正在使用Windows XP中的QT Creater.

在此先感谢,任何提示都被赞赏,因为我完全迷失了.

ser*_*nko 5

假设您已在系统上正确安装了poppler标头和库.我在ubuntu上运行:

./configure
make
make install
Run Code Online (Sandbox Code Playgroud)

制作并安装了poppler库.根据我的理解,你可以在windows上使用msys/mingw来实现类似的功能.

现在在您的.pro文件中添加以下行:

INCLUDEPATH += /path_to_poppler_include_files/qt4
LIBS += -L/path_to_poppler_libs -lpoppler-qt4
Run Code Online (Sandbox Code Playgroud)

和这样的代码:

#include <poppler-qt4.h>

....

QString filename;

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

应该为你建立和运行.

希望这有帮助,问候