From bc28954ec99d3d42f301e4cf2dff16f373a4c95e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20Aliste?= <jaliste@src.gnome.org>
Date: Mon, 8 Sep 2014 23:17:07 -0300
Subject: [PATCH 1/2] Add Page->displayAnnot method

With this method we can draw only one annotation
---
 poppler/Page.cc | 30 ++++++++++++++++++++++++++++++
 poppler/Page.h  |  6 ++++++
 2 files changed, 36 insertions(+)

diff --git a/poppler/Page.cc b/poppler/Page.cc
index ecdff32..2ae7270 100644
--- a/poppler/Page.cc
+++ b/poppler/Page.cc
@@ -616,6 +616,36 @@ void Page::displaySlice(OutputDev *out, double hDPI, double vDPI,
   }
 }
 
+void Page::displayAnnot(Annot *annot, OutputDev *out, double hDPI, double vDPI,
+			int rotate, GBool useMediaBox, GBool crop,
+			int sliceX, int sliceY, int sliceW, int sliceH,
+			GBool (*abortCheckCbk)(void *data),
+			void *abortCheckCbkData,
+                        GBool copyXRef) {
+  Gfx *gfx;
+  Object obj;
+
+  pageLocker();
+  XRef *localXRef = (copyXRef) ? xref->copy() : xref;
+  if (copyXRef) {
+    replaceXRef(localXRef);
+  }
+
+  gfx = createGfx(out, hDPI, vDPI, rotate, useMediaBox, crop,
+		  sliceX, sliceY, sliceW, sliceH,
+		  gFalse,
+		  abortCheckCbk, abortCheckCbkData, localXRef);
+
+  annot->draw(gfx, gFalse);
+  out->dump();
+
+  delete gfx;
+  if (copyXRef) {
+    replaceXRef(doc->getXRef());
+    delete localXRef;
+  }
+}
+
 void Page::display(Gfx *gfx) {
   Object obj;
 
diff --git a/poppler/Page.h b/poppler/Page.h
index 2aaabae..6693edd 100644
--- a/poppler/Page.h
+++ b/poppler/Page.h
@@ -247,6 +247,12 @@ public:
                     GBool (*annotDisplayDecideCbk)(Annot *annot, void *user_data) = NULL,
                     void *annotDisplayDecideCbkData = NULL,
                     GBool copyXRef = gFalse);
+  void displayAnnot(Annot *annot, OutputDev *out, double hDPI, double vDPI,
+		   int rotate, GBool useMediaBox, GBool crop,
+			int sliceX, int sliceY, int sliceW, int sliceH,
+			GBool (*abortCheckCbk)(void *data),
+			void *abortCheckCbkData,
+                        GBool copyXRef = gFalse);
 
   void display(Gfx *gfx);
 
-- 
1.9.3

