Tue Apr 26 13:13:42 2005 Jonathan Blandford <jrb@redhat.com>

        * glib/test-poppler-glib.c (main): add a quick dump-to-text test.
parent 44b800d5
Tue Apr 26 13:13:42 2005 Jonathan Blandford <jrb@redhat.com>
* glib/test-poppler-glib.c (main): add a quick dump-to-text test.
2005-04-24 Kristian Høgsberg <krh@redhat.com>
* qt/Makefile.am (libpoppler_qt_la_SOURCES): Add poppler-private.h
......
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "poppler.h"
#define FAIL(msg) \
......@@ -56,6 +57,8 @@ int main (int argc, char *argv[])
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 @@ int main (int argc, char *argv[])
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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment