Browse Source

Merge pull request #1494 from yurydelendik/convert-docinfo

Convert Unicode strings in the document info
Brendan Dahl 13 years ago
parent
commit
2e92c0ea08
  1. 11
      src/core.js
  2. 4
      web/viewer.js

11
src/core.js

@ -597,8 +597,15 @@ var PDFDocModel = (function PDFDocModelClosure() {
}, },
getDocumentInfo: function PDFDocModel_getDocumentInfo() { getDocumentInfo: function PDFDocModel_getDocumentInfo() {
var info; var info;
if (this.xref.trailer.has('Info')) if (this.xref.trailer.has('Info')) {
info = this.xref.trailer.get('Info'); var infoDict = this.xref.trailer.get('Info');
info = {};
infoDict.forEach(function(key, value) {
info[key] = typeof value !== 'string' ? value :
stringToPDFString(value);
});
}
return shadow(this, 'getDocumentInfo', info); return shadow(this, 'getDocumentInfo', info);
}, },

4
web/viewer.js

@ -571,8 +571,8 @@ var PDFView = {
pdfTitle = metadata.get('dc:title'); pdfTitle = metadata.get('dc:title');
} }
if (!pdfTitle && info && info.has('Title')) if (!pdfTitle && info && info['Title'])
pdfTitle = info.get('Title'); pdfTitle = info['Title'];
if (pdfTitle) if (pdfTitle)
document.title = pdfTitle; document.title = pdfTitle;

Loading…
Cancel
Save