1
#include <QtCore/QCoreApplication>
2
#include <QtCore/QDebug>
6
#include <poppler-qt4.h>
8
int main( int argc, char **argv )
10
QCoreApplication a( argc, argv ); // QApplication required!
14
qWarning() << "usage: poppler-texts filename";
18
Poppler::Document *doc = Poppler::Document::load(argv[1]);
21
qWarning() << "doc not loaded";
25
for ( int i = 0; i < doc->numPages(); i++ )
28
std::cout << "*** Page " << i << std::endl;
29
std::cout << std::flush;
31
Poppler::Page *page = doc->page(i);
32
const QByteArray utf8str = page->text( QRectF(), Poppler::Page::RawOrderLayout ).toUtf8();
33
std::cout << std::flush;
34
for ( j = 0; j < utf8str.size(); j++ )
35
std::cout << utf8str[j];
36
std::cout << std::endl;