[poppler] glib/poppler-page.cc poppler/Annot.h

Carlos Garcia Campos carlosgc at kemper.freedesktop.org
Fri Oct 19 03:22:58 PDT 2007


 glib/poppler-page.cc |   25 ++++++++++++++++++++++---
 poppler/Annot.h      |    2 ++
 2 files changed, 24 insertions(+), 3 deletions(-)

New commits:
commit e1740278457e512676b623bcdf9968193f0a8d7b
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Fri Oct 19 12:21:54 2007 +0200

    Do not draw annotations when rendering for printing

diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc
index 3671001..e325092 100644
--- a/glib/poppler-page.cc
+++ b/glib/poppler-page.cc
@@ -406,6 +406,21 @@ poppler_page_copy_to_pixbuf(PopplerPage *page,
 
 #endif
 
+static GBool
+poppler_print_annot_cb (Annot *annot, void *user_data)
+{
+  GooString *annot_type;
+
+  annot_type = annot->getType ();
+  if (!annot_type)
+    return gFalse;
+  
+  if (annot_type->cmp ("Widget") == 0)
+    return gTrue;
+
+  return gFalse;
+}
+
 #if defined (HAVE_CAIRO)
 
 static void
@@ -429,7 +444,9 @@ _poppler_page_render (PopplerPage *page,
 			   -1, -1,
 			   -1, -1,
 			   printing,
-			   page->document->doc->getCatalog ());
+			   page->document->doc->getCatalog (),
+			   NULL, NULL,
+			   printing ? poppler_print_annot_cb : NULL, NULL);
 
   output_dev->setCairo (NULL);	
 }
@@ -469,7 +486,7 @@ poppler_page_render_for_printing (PopplerPage *page,
   _poppler_page_render (page, cairo, gTrue);	
 }
 
-#endif
+#endif /* HAVE_CAIRO */
 
 static void
 _poppler_page_render_to_pixbuf (PopplerPage *page,
@@ -492,7 +509,9 @@ _poppler_page_render_to_pixbuf (PopplerPage *page,
 			   src_x, src_y,
 			   src_width, src_height,
 			   printing,
-			   page->document->doc->getCatalog ());
+			   page->document->doc->getCatalog (),
+			   NULL, NULL,
+			   printing ? poppler_print_annot_cb : NULL, NULL);
   
   poppler_page_copy_to_pixbuf (page, pixbuf, &data);
 }
diff --git a/poppler/Annot.h b/poppler/Annot.h
index a567c9f..50f5bfb 100644
--- a/poppler/Annot.h
+++ b/poppler/Annot.h
@@ -87,6 +87,8 @@ public:
 
   double getFontSize() { return fontSize; }
 
+  GooString *getType() { return type; }
+
 private:
   void setColor(Array *a, GBool fill, int adjust);
   void drawText(GooString *text, GooString *da, GfxFontDict *fontDict,


More information about the poppler mailing list