--- poppler/Annot.cc 2017-06-21 22:31:18.000000000 +0200 +++ poppler/Annot.cc 2017-07-08 09:16:36.027102200 +0200 @@ -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); --- poppler/Annot.h 2017-06-17 18:35:25.000000000 +0200 +++ poppler/Annot.h 2017-07-08 09:15:36.247854900 +0200 @@ -582,6 +582,7 @@ // Sets the annot contents to new_content // new_content should never be NULL 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); @@ -603,6 +604,7 @@ PDFRectangle *getRect() const { return rect; } void getRect(double *x1, double *y1, double *x2, double *y2) const; 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; } @@ -661,6 +663,7 @@ // optional data GooString *contents; // Contents + GooString *author; // T GooString *name; // NM GooString *modified; // M int page; // P