[poppler] 2 commits - qt4/src qt4/tests
Albert Astals Cid
aacid at kemper.freedesktop.org
Wed Sep 1 12:44:20 PDT 2010
qt4/src/poppler-page.cc | 2 +-
qt4/src/poppler-qt4.h | 5 ++++-
qt4/tests/poppler-texts.cpp | 40 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 45 insertions(+), 2 deletions(-)
New commits:
commit 3b4816b2b8caa0e2baafbe4c0eb1e45e452d01ce
Author: Albert Astals Cid <aacid at kde.org>
Date: Wed Sep 1 20:43:35 2010 +0100
forgot the file
diff --git a/qt4/tests/poppler-texts.cpp b/qt4/tests/poppler-texts.cpp
new file mode 100644
index 0000000..ec28353
--- /dev/null
+++ b/qt4/tests/poppler-texts.cpp
@@ -0,0 +1,40 @@
+#include <QtCore/QCoreApplication>
+#include <QtCore/QDebug>
+
+#include <iostream>
+
+#include <poppler-qt4.h>
+
+int main( int argc, char **argv )
+{
+ QCoreApplication a( argc, argv ); // QApplication required!
+
+ if (!( argc == 2 ))
+ {
+ qWarning() << "usage: poppler-texts filename";
+ exit(1);
+ }
+
+ Poppler::Document *doc = Poppler::Document::load(argv[1]);
+ if (!doc)
+ {
+ qWarning() << "doc not loaded";
+ exit(1);
+ }
+
+ for ( int i = 0; i < doc->numPages(); i++ )
+ {
+ int j = 0;
+ std::cout << "*** Page " << i << std::endl;
+ std::cout << std::flush;
+
+ Poppler::Page *page = doc->page(i);
+ const QByteArray utf8str = page->text( QRectF(), Poppler::Page::RawOrderLayout ).toUtf8();
+ std::cout << std::flush;
+ for ( j = 0; j < utf8str.size(); j++ )
+ std::cout << utf8str[j];
+ std::cout << std::endl;
+ delete page;
+ }
+ delete doc;
+}
commit b0db93c71a83946aa3e02bae6b396223dcca19d1
Author: Albert Astals Cid <aacid at kde.org>
Date: Wed Sep 1 20:43:14 2010 +0100
add since and rename enum
diff --git a/qt4/src/poppler-page.cc b/qt4/src/poppler-page.cc
index 49a0a77..293d09b 100644
--- a/qt4/src/poppler-page.cc
+++ b/qt4/src/poppler-page.cc
@@ -303,7 +303,7 @@ QString Page::text(const QRectF &r, TextLayout textLayout) const
PDFRectangle *rect;
QString result;
- const GBool rawOrder = textLayout == RawOrder;
+ const GBool rawOrder = textLayout == RawOrderLayout;
output_dev = new TextOutputDev(0, gFalse, rawOrder, gFalse);
m_page->parentDoc->doc->displayPageSlice(output_dev, m_page->index + 1, 72, 72,
0, false, true, false, -1, -1, -1, -1);
diff --git a/qt4/src/poppler-qt4.h b/qt4/src/poppler-qt4.h
index 5ed7218..5ddaaf8 100644
--- a/qt4/src/poppler-qt4.h
+++ b/qt4/src/poppler-qt4.h
@@ -391,10 +391,11 @@ delete it;
/**
How the text is going to be returned
+ \since 0.16
*/
enum TextLayout {
PhysicalLayout, ///< The text is layouted to resemble the real page layout
- RawOrder ///< The text is returned without any type of processing
+ RawOrderLayout ///< The text is returned without any type of processing
};
/**
@@ -453,6 +454,8 @@ delete it;
\param rect the rectangle specifying the area of interest,
with coordinates given in points, i.e., 1/72th of an inch.
If rect is null, all text on the page is given
+
+ \since 0.16
**/
QString text(const QRectF &rect, TextLayout textLayout) const;
More information about the poppler
mailing list