[poppler] [PATCH] author added to poppler's annotations
Jannick
thirdedition at gmx.net
Sat Jul 8 07:42:48 UTC 2017
Dear All,
please find attached - and copied below - a proposed patch for your
consideration to include annotation author information to poppler.
Thanks,
J.
--- Annot.cc Wed Jun 21 22:31:18 2017
+++ Annot.cc Sat Jul 08 09:16:36 2017
@@ -1285,6 +1285,13 @@
}
obj1.free();
+ if (dict->lookup("T", &obj1)->isString()) {
+ author = obj1.getString()->copy();
+ } else {
+ author = new GooString();
+ }
+ obj1.free();
+
// Note: This value is overwritten by Annots ctor
if (dict->lookupNF("P", &obj1)->isRef()) {
Ref ref = obj1.getRef();
@@ -1460,6 +1467,21 @@
update ("Contents", &obj1);
}
+void Annot::setAuthor(GooString *new_author) {
+ annotLocker();
+ delete author;
+
+ if (new_author) {
+ author = new GooString(new_author);
+ } else {
+ author = new GooString();
+ }
+
+ Object obj1;
+ obj1.initString(name->copy());
+ update ("T", &obj1);
+}
+
void Annot::setName(GooString *new_name) {
annotLocker();
delete name;
@@ -1658,6 +1680,7 @@
delete rect;
delete contents;
+ delete author;
if (name)
delete name;
@@ -3050,6 +3073,8 @@
fontcolor = new AnnotColor(0, 0, 0); // Black
if (!contents)
contents = new GooString ();
+ if (!author)
+ author = new GooString ();
// Draw box
GBool doFill = (color && color->getSpace() !=
AnnotColor::colorTransparent);
--- Annot.h Sat Jun 17 18:35:25 2017
+++ Annot.h Sat Jul 08 09:15:36 2017
@@ -581,7 +581,8 @@
// Sets the annot contents to new_content
// new_content should never be NULL
- virtual void setContents(GooString *new_content);
+ virtual void setContents(GooString *new_content);
+ virtual void setAuthor(GooString *new_author);
void setName(GooString *new_name);
void setModified(GooString *new_date);
void setFlags(Guint new_flags);
@@ -602,7 +603,8 @@
AnnotSubtype getType() const { return type; }
PDFRectangle *getRect() const { return rect; }
void getRect(double *x1, double *y1, double *x2, double *y2) const;
- GooString *getContents() const { return contents; }
+ GooString *getContents() const { return contents; }
+ GooString *getAuthor() const { return author; }
int getPageNum() const { return page; }
GooString *getName() const { return name; }
GooString *getModified() const { return modified; }
@@ -660,7 +662,8 @@
PDFRectangle *rect; // Rect
// optional data
- GooString *contents; // Contents
+ GooString *contents; // Contents
+ GooString *author; // T
GooString *name; // NM
GooString *modified; // M
int page; // P
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/poppler/attachments/20170708/af23f10f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: poppler-0.56.0-add_author_to_annotations.patch
Type: application/octet-stream
Size: 2502 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/poppler/attachments/20170708/af23f10f/attachment.obj>
More information about the poppler
mailing list