[poppler] Getting metadata?

Wilco Greven greven at kde.org
Sat Mar 5 02:55:40 PST 2005


Op zaterdag 05 maart 2005 6:30, schreef Brad Hards:
> I'm working on a conversion of the KDE PDF meta-data plugin to Poppler - it
> current exec()'s pdfinfo. I have it working for the more standard things,
> such as number of pages, whether it is encrypted, whether it is linearised,
> and which PDF version the document is.
>
> I'm having trouble figuring out some of the deeper stuff, like how to get
> the date/time for creation and modification, and what the fonts are. I saw
> readMetadata(), and gave that a try (calling GooString->getCString() on the
> result), but it segfaulted.
>
> So given a PDFDoc object, how do I extract and convert the metadata?

You can extract it from the Info dictionary (PDFDoc::getDocInfo).

Object creationDate;
doc->getDocInfo()->dictLookup("CreationDate", &creationDate);
if (creationDate.isString())
  myDateString = creationDate.getString()->getCString();

Greetings,
Wilco



More information about the poppler mailing list