[poppler] glib/poppler-page.cc
Carlos Garcia Campos
carlosgc at kemper.freedesktop.org
Sat Jan 23 02:44:09 PST 2010
glib/poppler-page.cc | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
New commits:
commit 6825a219f0bc0ac6fd469fb8a6ebb86df774375f
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date: Sat Jan 23 11:24:15 2010 +0100
[glib] Use TextOutputDev to get TextPage when we haven't rendered the page
diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc
index 4514f9c..2448644 100644
--- a/glib/poppler-page.cc
+++ b/glib/poppler-page.cc
@@ -268,15 +268,24 @@ static TextPage *
poppler_page_get_text_page (PopplerPage *page)
{
if (page->text == NULL) {
- cairo_t *cr;
- cairo_surface_t *surface;
-
- surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, 1, 1);
- cr = cairo_create (surface);
- poppler_page_render (page, cr);
- cairo_destroy (cr);
- cairo_surface_destroy (surface);
-
+ TextOutputDev *text_dev;
+ Gfx *gfx;
+
+ text_dev = new TextOutputDev (NULL, gTrue, gFalse, gFalse);
+ gfx = page->page->createGfx(text_dev,
+ 72.0, 72.0, 0,
+ gFalse, /* useMediaBox */
+ gTrue, /* Crop */
+ -1, -1, -1, -1,
+ gFalse, /* printing */
+ page->document->doc->getCatalog (),
+ NULL, NULL, NULL, NULL);
+ page->page->display(gfx);
+ text_dev->endPage();
+
+ page->text = text_dev->takeText();
+ delete gfx;
+ delete text_dev;
}
return page->text;
More information about the poppler
mailing list