hello carlos,

i see you're touching poppler-glib these days.

would it be possible to consider my attached patch.

it lets selecting the text on a whole page not through the selection function
that has a bug introduced earlier.

i'm here for any question.

thanks in advance,
alex

On 10/16/2011 12:45 PM, Carlos Garcia Campos wrote:
>  CMakeLists.txt                 |    1 -
>  configure.ac                   |    2 --
>  poppler-glib-uninstalled.pc.in |    2 +-
>  poppler-glib.pc.cmake          |    2 +-
>  poppler-glib.pc.in             |    2 +-
>  5 files changed, 3 insertions(+), 6 deletions(-)
> 
> New commits:
> commit 185ed4f3c98f162fe3ddb00d4aa0b637988dfad9
> Author: Carlos Garcia Campos <[email protected]>
> Date:   Sun Oct 16 12:40:27 2011 +0200
> 
>     Remove poppler-cairo dependency from poppler-glib pkg-config file
>     
>     poppler-glib links to poppler-cairo statically, so it doesn'tm depend on
>     the dynamic library.
> 
> diff --git a/CMakeLists.txt b/CMakeLists.txt
> index 552c285..d3bb385 100644
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -93,7 +93,6 @@ if(CAIRO_FOUND)
>      # Check for introspection
>      macro_optional_find_package(GObjectIntrospection 0.9.12)
>      set(HAVE_INTROSPECTION ${INTROSPECTION_FOUND})
> -    set(GLIB_REQ "glib-2.0 >= ${GLIB_REQUIRED} gobject-2.0 >= 
> ${GLIB_REQUIRED} cairo >= ${CAIRO_VERSION}")
>      set(POPPLER_GLIB_DISABLE_DEPRECATED "${POPPLER_GLIB_DISABLE_DEPRECATED} 
> -DG_DISABLE_DEPRECATED")
>      set(POPPLER_GLIB_DISABLE_SINGLE_INCLUDES 
> "${POPPLER_GLIB_DISABLE_SINGLE_INCLUDES} -DG_DISABLE_SINGLE_INCLUDES")
>      macro_optional_find_package(GTK)
> diff --git a/configure.ac b/configure.ac
> index 7293d1f..f64aa49 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -425,7 +425,6 @@ if test x$enable_cairo_output = xyes; then
>      # Check for introspection
>      GOBJECT_INTROSPECTION_CHECK([0.6.7])
>  
> -    GLIB_REQ="glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED cairo 
> >= $CAIRO_VERSION"
>      AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums])
>      POPPLER_GLIB_DISABLE_DEPRECATED="$POPPLER_GLIB_DISABLE_DEPRECATED 
> -DG_DISABLE_DEPRECATED"
>      
> POPPLER_GLIB_DISABLE_SINGLE_INCLUDES="$POPPLER_GLIB_DISABLE_SINGLE_INCLUDES 
> -DG_DISABLE_SINGLE_INCLUDES"
> @@ -435,7 +434,6 @@ else
>      AC_MSG_ERROR("Cairo output is required to build glib frontend")
>    fi
>    enable_poppler_glib="no"
> -  GLIB_REQ=""
>  fi
>  AM_CONDITIONAL(BUILD_POPPLER_GLIB, test x$enable_poppler_glib = xyes)
>  AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = "xyes")
> diff --git a/poppler-glib-uninstalled.pc.in b/poppler-glib-uninstalled.pc.in
> index d0d63f4..55a2278 100644
> --- a/poppler-glib-uninstalled.pc.in
> +++ b/poppler-glib-uninstalled.pc.in
> @@ -1,7 +1,7 @@
>  Name: poppler-glib
>  Description: GLib wrapper for poppler - uninstalled
>  Version: @VERSION@
> -Requires: poppler-cairo = @VERSION@ @GLIB_REQ@
> +Requires: glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED cairo >= 
> $CAIRO_VERSION
>  
>  Libs: ${pc_top_builddir}/${pcfiledir}/glib/libpoppler-glib.la
>  Cflags: -I${pc_top_builddir}/${pcfiledir}/glib
> diff --git a/poppler-glib.pc.cmake b/poppler-glib.pc.cmake
> index 5e94015..3264ed6 100644
> --- a/poppler-glib.pc.cmake
> +++ b/poppler-glib.pc.cmake
> @@ -6,7 +6,7 @@ includedir=${prefix}/include
>  Name: poppler-glib
>  Description: GLib wrapper for poppler
>  Version: @POPPLER_VERSION@
> -Requires: poppler-cairo = @POPPLER_VERSION@ @GLIB_REQ@
> +Requires: glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED cairo >= 
> $CAIRO_VERSION
>  @PC_REQUIRES_PRIVATE@
>  
>  Libs: -L${libdir} -lpoppler-glib
> diff --git a/poppler-glib.pc.in b/poppler-glib.pc.in
> index 05b9a77..04d9bb9 100644
> --- a/poppler-glib.pc.in
> +++ b/poppler-glib.pc.in
> @@ -6,7 +6,7 @@ includedir=@includedir@
>  Name: poppler-glib
>  Description: GLib wrapper for poppler
>  Version: @VERSION@
> -Requires: poppler-cairo = @VERSION@ @GLIB_REQ@
> +Requires: glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED cairo >= 
> $CAIRO_VERSION
>  @PC_REQUIRES_PRIVATE@
>  
>  Libs: -L${libdir} -lpoppler-glib
> _______________________________________________
> poppler mailing list
> [email protected]
> http://lists.freedesktop.org/mailman/listinfo/poppler

diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc
index 9850d44..63f9955 100644
--- a/glib/poppler-page.cc
+++ b/glib/poppler-page.cc
@@ -843,13 +843,21 @@ poppler_page_get_selected_text (PopplerPage          *page,
 char *
 poppler_page_get_text (PopplerPage *page)
 {
-  PopplerRectangle rectangle = {0, 0, 0, 0};
+  GooString *sel_text;
+  double width, height;
+  char *result;
+  TextPage *text;
 
   g_return_val_if_fail (POPPLER_IS_PAGE (page), NULL);
 
-  poppler_page_get_size (page, &rectangle.x2, &rectangle.y2);
+  poppler_page_get_size (page, &width, &height);
+
+  text = poppler_page_get_text_page (page);
+  sel_text = text->getText (0, 0, width, height);
+  result = g_strdup (sel_text->getCString ());
+  delete sel_text;
 
-  return poppler_page_get_selected_text (page, POPPLER_SELECTION_GLYPH, &rectangle);
+  return result;
 }
 
 /**
_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to