1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-28 23:28:16 +02:00

Now also fetch 'Document Info Dictionary', and expose 'raw' metadata attributes

This commit is contained in:
Saebekassebil 2012-03-26 23:48:04 +02:00
parent ab198e89cc
commit edc1694620
3 changed files with 29 additions and 28 deletions

View file

@ -44,25 +44,7 @@ var Metadata = (function MetadataClosure() {
for (ii = 0, iLength = entries.length; ii < iLength; ii++) {
var entry = entries[ii];
var name = entry.nodeName.toLowerCase();
var entryName = name.split(':');
entryName = (entryName.length > 1) ? entryName[1] : entryName[0];
switch (name) {
case 'pdf:moddate':
case 'xap:createdate':
case 'xap:metadatadate':
case 'xap:modifydate':
this.metadata[entryName] = new Date(entry.textContent.trim());
break;
default:
// For almost all entries we just add them to the metadata object
if (this.metadata[entryName]) {
this.metadata[name] = entry.textContent.trim();
} else {
this.metadata[entryName] = entry.textContent.trim();
}
break;
}
this.metadata[name] = entry.textContent.trim();
}
}
},