[poppler] poppler/glib: test-poppler-glib.c,1.8,1.9

Jonathan Blandford jrb at freedesktop.org
Tue Apr 26 10:17:07 PDT 2005


Update of /cvs/poppler/poppler/glib
In directory gabe:/tmp/cvs-serv25819/glib

Modified Files:
	test-poppler-glib.c 
Log Message:
Tue Apr 26 13:13:42 2005  Jonathan Blandford  <jrb at redhat.com>

        * glib/test-poppler-glib.c (main): add a quick dump-to-text test.



Index: test-poppler-glib.c
===================================================================
RCS file: /cvs/poppler/poppler/glib/test-poppler-glib.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- test-poppler-glib.c	16 Apr 2005 18:57:44 -0000	1.8
+++ test-poppler-glib.c	26 Apr 2005 17:17:05 -0000	1.9
@@ -1,5 +1,6 @@
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include "poppler.h"
 
 #define FAIL(msg) \
@@ -56,6 +57,8 @@
   GdkPixbuf *pixbuf, *thumb;
   double width, height;
   GList *list, *l;
+  char *text;
+  PopplerRectangle area;
 
   if (argc != 3)
     FAIL ("usage: test-poppler-glib FILE PAGE");
@@ -101,6 +104,23 @@
   if (error != NULL)
     FAIL (error->message);
 
+  area.x1 = 0;
+  area.y1 = 0;
+  area.x2 = width;
+  area.y2 = height;
+
+  text = poppler_page_get_text (page, &area);
+  if (text)
+    {
+      FILE *file = fopen ("dump.txt", "w");
+      if (file)
+	{
+	  fwrite (text, strlen (text), 1, file);
+	  fclose (file);
+	}
+      g_free (text);
+    }
+
   list = poppler_page_find_text (page, "Bitwise");
   printf ("Found text \"Bitwise\" at positions:\n");
   for (l = list; l != NULL; l = l->next)



More information about the poppler mailing list