]> git.parisson.com Git - pdf.js.git/commitdiff
Convert Unicode strings in the document info (#1458)
authorYury Delendik <ydelendik@mozilla.com>
Thu, 5 Apr 2012 15:40:37 +0000 (10:40 -0500)
committerYury Delendik <ydelendik@mozilla.com>
Thu, 5 Apr 2012 15:40:37 +0000 (10:40 -0500)
src/core.js
web/viewer.js

index a90974386fccb1558b37d86dbf2bd9ea6b712eb4..3f3e95294dcdd9a602081e09dd9bd6c7332a74ce 100644 (file)
@@ -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);
     },
index 8977b53c03f4405580c2dd781d4d4fa2f277f681..72e887f4a75d4dab2086a4b463c6147a64e2aadb 100644 (file)
@@ -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;