Hi all,
Created patch for set the title of the screen annotation.
Please give your suggestions.
Thanks
--
A Srinivas
Index: poppler-0.16.2/poppler/Annot.h
===================================================================
--- poppler-0.16.2/poppler/Annot.h (revision 14)
+++ poppler-0.16.2/poppler/Annot.h (working copy)
@@ -736,6 +736,7 @@
~AnnotScreen();
GooString* getTitle() { return title; }
+ void setTitle(GooString *title);
AnnotAppearanceCharacs *getAppearCharacs() { return appearCharacs; }
LinkAction* getAction() { return action; }
Index: poppler-0.16.2/poppler/Annot.cc
===================================================================
--- poppler-0.16.2/poppler/Annot.cc (revision 14)
+++ poppler-0.16.2/poppler/Annot.cc (working copy)
@@ -4258,6 +4258,24 @@
}
+void AnnotScreen::setTitle(GooString *title) {
+ GooString *new_title;
+ if (title) {
+ new_title = new GooString(title);
+ if (!new_title->hasUnicodeMarker()) {
+ new_title->insert(0, 0xff);
+ new_title->insert(0, 0xfe);
+ }
+ }
+ else
+ new_title = new GooString();
+
+ Object obj1;
+ obj1.initString(new_title->copy());
+ update ("T", &obj1);
+ delete new_title;
+}
+
//------------------------------------------------------------------------
// AnnotStamp
//------------------------------------------------------------------------
Index: poppler-0.16.2/glib/poppler-annot.cc
===================================================================
--- poppler-0.16.2/glib/poppler-annot.cc (revision 14)
+++ poppler-0.16.2/glib/poppler-annot.cc (working copy)
@@ -1337,6 +1337,35 @@
}
/**
+ * poppler_annot_screen_set_title:
+ * @poppler_annot: a #PopplerAnnot
+ * @title: a text string containing the new contents
+ *
+ * Sets the title of @poppler_annot.
+ *
+ * Since: 0.18
+ **/
+void
+poppler_annot_screen_set_title (PopplerAnnotScreen *poppler_annot,
+ const gchar *title)
+{
+ AnnotScreen *annot;
+ GooString *goo_tmp;
+ gchar *tmp;
+ gsize length = 0;
+
+ g_return_if_fail (POPPLER_IS_ANNOT_SCREEN (poppler_annot));
+
+ annot = static_cast<AnnotScreen *>(POPPLER_ANNOT (poppler_annot)->annot);
+
+ tmp = title ? g_convert (title, -1, "UTF-16BE", "UTF-8", NULL, &length, NULL) : NULL;
+ goo_tmp = new GooString (tmp, length);
+ g_free (tmp);
+
+ annot->setTitle (goo_tmp);
+ delete (goo_tmp);
+}
+/**
* poppler_annot_movie_get_movie:
* @poppler_annot: a #PopplerAnnotMovie
*
Index: poppler-0.16.2/glib/poppler-annot.h
===================================================================
--- poppler-0.16.2/glib/poppler-annot.h (revision 14)
+++ poppler-0.16.2/glib/poppler-annot.h (working copy)
@@ -218,7 +218,10 @@
/* PopplerAnnotScreen */
GType poppler_annot_screen_get_type (void) G_GNUC_CONST;
PopplerAction *poppler_annot_screen_get_action (PopplerAnnotScreen *poppler_annot);
+void poppler_annot_screen_set_title (PopplerAnnotScreen *poppler_annot,
+ const gchar *title);
+
/* PopplerCalloutLine */
GType poppler_annot_callout_line_get_type (void) G_GNUC_CONST;
PopplerAnnotCalloutLine *poppler_annot_callout_line_new (void);
_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler