Convert Unicode strings in the document info (#1458)
This commit is contained in:
parent
1a067ccf40
commit
08a241fc4b
11
src/core.js
11
src/core.js
@ -596,8 +596,15 @@ var PDFDocModel = (function PDFDocModelClosure() {
|
||||
},
|
||||
getDocumentInfo: function PDFDocModel_getDocumentInfo() {
|
||||
var info;
|
||||
if (this.xref.trailer.has('Info'))
|
||||
info = this.xref.fetch(this.xref.trailer.get('Info'));
|
||||
if (this.xref.trailer.has('Info')) {
|
||||
var infoDict = this.xref.fetch(this.xref.trailer.get('Info'));
|
||||
|
||||
info = {};
|
||||
infoDict.forEach(function(key, value) {
|
||||
info[key] = typeof value !== 'string' ? value :
|
||||
stringToPDFString(value);
|
||||
});
|
||||
}
|
||||
|
||||
return shadow(this, 'getDocumentInfo', info);
|
||||
},
|
||||
|
@ -571,8 +571,8 @@ var PDFView = {
|
||||
pdfTitle = metadata.get('dc:title');
|
||||
}
|
||||
|
||||
if (!pdfTitle && info && info.has('Title'))
|
||||
pdfTitle = info.get('Title');
|
||||
if (!pdfTitle && info && info['Title'])
|
||||
pdfTitle = info['Title'];
|
||||
|
||||
if (pdfTitle)
|
||||
document.title = pdfTitle;
|
||||
|
Loading…
Reference in New Issue
Block a user