--- poppler/Annot.cc 2017-06-21 22:31:18.000000000 +0200 +++ poppler/Annot.cc 2017-07-14 15:28:57.345594500 +0200 @@ -1285,6 +1285,13 @@ void Annot::initialize(PDFDoc *docA, Dic } 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(); @@ -1302,6 +1309,13 @@ void Annot::initialize(PDFDoc *docA, Dic } obj1.free(); + if (dict->lookup("CreationDate", &obj1)->isString()) { + created = obj1.getString()->copy(); + } else { + created = NULL; + } + obj1.free(); + if (dict->lookup("M", &obj1)->isString()) { modified = obj1.getString()->copy(); } else { @@ -1460,6 +1474,21 @@ void Annot::setContents(GooString *new_c 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; @@ -1475,6 +1504,20 @@ void Annot::setName(GooString *new_name) update ("NM", &obj1); } +void Annot::setCreated(GooString *new_created) { + annotLocker(); + delete created; + + if (new_created) + created = new GooString(new_created); + else + created = new GooString(); + + Object obj1; + obj1.initString(created->copy()); + update ("CreationDate", &obj1); +} + void Annot::setModified(GooString *new_modified) { annotLocker(); delete modified; @@ -1658,10 +1701,14 @@ Annot::~Annot() { delete rect; delete contents; + delete author; if (name) delete name; + if (created) + delete created; + if (modified) delete modified; @@ -3050,6 +3097,8 @@ void AnnotFreeText::generateFreeTextAppe 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-14 15:37:28.738895200 +0200 @@ -582,7 +582,9 @@ public: // Sets the annot contents to new_content // new_content should never be NULL virtual void setContents(GooString *new_content); + void setAuthor(GooString *new_author); void setName(GooString *new_name); + void setCreated(GooString *new_date); void setModified(GooString *new_date); void setFlags(Guint new_flags); @@ -603,8 +605,10 @@ public: 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 *getCreated() const { return created; } GooString *getModified() const { return modified; } Guint getFlags() const { return flags; } AnnotAppearance *getAppearStreams() const { return appearStreams; } @@ -661,7 +665,9 @@ protected: // optional data GooString *contents; // Contents + GooString *author; // T GooString *name; // NM + GooString *created; // CreationDate GooString *modified; // M int page; // P Guint flags; // F (must be a 32 bit unsigned int)