Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--backend/pdf/ev-poppler.cc28
-rw-r--r--configure.ac1
2 files changed, 26 insertions, 3 deletions
diff --git a/backend/pdf/ev-poppler.cc b/backend/pdf/ev-poppler.cc
index 655d589..64ac308 100644
--- a/backend/pdf/ev-poppler.cc
+++ b/backend/pdf/ev-poppler.cc
@@ -1906,12 +1906,18 @@ pdf_selection_get_selected_text (EvSelection *selection,
EvRectangle *points)
{
PopplerPage *poppler_page;
- PopplerRectangle r;
- double height;
char *retval;
-
+
poppler_page = POPPLER_PAGE (page->backend_page);
+#ifdef HAVE_POPPLER_PAGE_GET_SELECTED_TEXT
+ retval = poppler_page_get_selected_text (poppler_page,
+ (PopplerSelectionStyle)style,
+ (PopplerRectangle *)points);
+#else
+ PopplerRectangle r;
+ double height;
+
poppler_page_get_size (poppler_page, NULL, &height);
r.x1 = points->x1;
r.y1 = height - points->y2;
@@ -1921,6 +1927,7 @@ pdf_selection_get_selected_text (EvSelection *selection,
retval = poppler_page_get_text (poppler_page,
(PopplerSelectionStyle)style,
&r);
+#endif /* HAVE_POPPLER_PAGE_GET_SELECTED_TEXT */
return retval;
}
@@ -2008,6 +2015,20 @@ pdf_document_text_get_text_mapping (EvDocumentText *document_text,
return retval;
}
+#ifdef HAVE_POPPLER_PAGE_GET_SELECTED_TEXT
+static gchar *
+pdf_document_text_get_text (EvDocumentText *selection,
+ EvPage *page)
+{
+ PopplerPage *poppler_page;
+
+ g_return_val_if_fail (POPPLER_IS_PAGE (page->backend_page), NULL);
+
+ poppler_page = POPPLER_PAGE (page->backend_page);
+
+ return poppler_page_get_text (poppler_page);
+}
+#else
static gchar *
pdf_document_text_get_text (EvDocumentText *selection,
EvPage *page)
@@ -2027,6 +2048,7 @@ pdf_document_text_get_text (EvDocumentText *selection,
POPPLER_SELECTION_WORD,
&r);
}
+#endif /* HAVE_POPPLER_PAGE_GET_SELECTED_TEXT */
#ifdef HAVE_POPPLER_PAGE_GET_TEXT_LAYOUT
static gboolean
diff --git a/configure.ac b/configure.ac
index 5135ecb..8b7a286 100644
--- a/configure.ac
+++ b/configure.ac
@@ -481,6 +481,7 @@ if test "x$enable_pdf" = "xyes"; then
evince_save_LIBS=$LIBS
LIBS="$LIBS $POPPLER_LIBS"
AC_CHECK_FUNCS(poppler_page_get_text_layout)
+ AC_CHECK_FUNCS(poppler_page_get_selected_text)
LIBS=$evince_save_LIBS
PKG_CHECK_MODULES(CAIRO_PDF, cairo-pdf, enable_cairo_pdf=yes, enable_cairo_pdf=no)
if test x$enable_cairo_pdf = xyes; then