diff --git a/bower.json b/bower.json index 68a05b41a..cd89398ac 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "pdfjs-dist", - "version": "1.1.86", + "version": "1.1.89", "main": [ "build/pdf.js", "build/pdf.worker.js" diff --git a/build/pdf.combined.js b/build/pdf.combined.js index 33fdcb24b..4faa145e8 100644 --- a/build/pdf.combined.js +++ b/build/pdf.combined.js @@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') { (typeof window !== 'undefined' ? window : this).PDFJS = {}; } -PDFJS.version = '1.1.86'; -PDFJS.build = '2bbe872'; +PDFJS.version = '1.1.89'; +PDFJS.build = 'dfecfca'; (function pdfjsWrapper() { // Use strict in our context only - users might not want it @@ -18208,7 +18208,11 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { return new ToUnicodeMap(cmap.getMap()); } else if (isStream(cmapObj)) { cmap = CMapFactory.create(cmapObj, - { url: PDFJS.cMapUrl, packed: PDFJS.cMapPacked }, null).getMap(); + { url: PDFJS.cMapUrl, packed: PDFJS.cMapPacked }, null); + if (cmap instanceof IdentityCMap) { + return new IdentityToUnicodeMap(0, 0xFFFF); + } + cmap = cmap.getMap(); // Convert UTF-16BE // NOTE: cmap can be a sparse array, so use forEach instead of for(;;) // to iterate over all keys. @@ -19703,6 +19707,7 @@ var CMap = (function CMapClosure() { // - bf chars are variable-length byte sequences, stored as strings, with // one byte per character. this._map = []; + this.name = ''; this.vertical = false; this.useCMap = null; this.builtInCMap = builtInCMap; @@ -19802,13 +19807,28 @@ var CMap = (function CMapClosure() { } out.charcode = 0; out.length = 1; + }, + + get isIdentityCMap() { + if (!(this.name === 'Identity-H' || this.name === 'Identity-V')) { + return false; + } + if (this._map.length !== 0x10000) { + return false; + } + for (var i = 0; i < 0x10000; i++) { + if (this._map[i] !== i) { + return false; + } + } + return true; } }; return CMap; })(); // A special case of CMap, where the _map array implicitly has a length of -// 65535 and each element is equal to its index. +// 65536 and each element is equal to its index. var IdentityCMap = (function IdentityCMapClosure() { function IdentityCMap(vertical, n) { CMap.call(this); @@ -19863,7 +19883,11 @@ var IdentityCMap = (function IdentityCMapClosure() { return map; }, - readCharCode: CMap.prototype.readCharCode + readCharCode: CMap.prototype.readCharCode, + + get isIdentityCMap() { + error('should not access .isIdentityCMap'); + } }; return IdentityCMap; @@ -20328,6 +20352,13 @@ var CMapFactory = (function CMapFactoryClosure() { } } + function parseCMapName(cMap, lexer) { + var obj = lexer.getObj(); + if (isName(obj) && isString(obj.name)) { + cMap.name = obj.name; + } + } + function parseCMap(cMap, lexer, builtInCMapParams, useCMap) { var previous; var embededUseCMap; @@ -20338,6 +20369,8 @@ var CMapFactory = (function CMapFactoryClosure() { } else if (isName(obj)) { if (obj.name === 'WMode') { parseWMode(cMap, lexer); + } else if (obj.name === 'CMapName') { + parseCMapName(cMap, lexer); } previous = obj; } else if (isCmd(obj)) { @@ -20447,6 +20480,9 @@ var CMapFactory = (function CMapFactoryClosure() { } catch (e) { warn('Invalid CMap data. ' + e); } + if (cMap.isIdentityCMap) { + return createBuiltInCMap(cMap.name, builtInCMapParams); + } return cMap; } error('Encoding required.'); diff --git a/build/pdf.js b/build/pdf.js index a9431eb7d..7301c155e 100644 --- a/build/pdf.js +++ b/build/pdf.js @@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') { (typeof window !== 'undefined' ? window : this).PDFJS = {}; } -PDFJS.version = '1.1.86'; -PDFJS.build = '2bbe872'; +PDFJS.version = '1.1.89'; +PDFJS.build = 'dfecfca'; (function pdfjsWrapper() { // Use strict in our context only - users might not want it diff --git a/build/pdf.worker.js b/build/pdf.worker.js index 85f34297d..5666b1f14 100644 --- a/build/pdf.worker.js +++ b/build/pdf.worker.js @@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') { (typeof window !== 'undefined' ? window : this).PDFJS = {}; } -PDFJS.version = '1.1.86'; -PDFJS.build = '2bbe872'; +PDFJS.version = '1.1.89'; +PDFJS.build = 'dfecfca'; (function pdfjsWrapper() { // Use strict in our context only - users might not want it @@ -11860,7 +11860,11 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { return new ToUnicodeMap(cmap.getMap()); } else if (isStream(cmapObj)) { cmap = CMapFactory.create(cmapObj, - { url: PDFJS.cMapUrl, packed: PDFJS.cMapPacked }, null).getMap(); + { url: PDFJS.cMapUrl, packed: PDFJS.cMapPacked }, null); + if (cmap instanceof IdentityCMap) { + return new IdentityToUnicodeMap(0, 0xFFFF); + } + cmap = cmap.getMap(); // Convert UTF-16BE // NOTE: cmap can be a sparse array, so use forEach instead of for(;;) // to iterate over all keys. @@ -13355,6 +13359,7 @@ var CMap = (function CMapClosure() { // - bf chars are variable-length byte sequences, stored as strings, with // one byte per character. this._map = []; + this.name = ''; this.vertical = false; this.useCMap = null; this.builtInCMap = builtInCMap; @@ -13454,13 +13459,28 @@ var CMap = (function CMapClosure() { } out.charcode = 0; out.length = 1; + }, + + get isIdentityCMap() { + if (!(this.name === 'Identity-H' || this.name === 'Identity-V')) { + return false; + } + if (this._map.length !== 0x10000) { + return false; + } + for (var i = 0; i < 0x10000; i++) { + if (this._map[i] !== i) { + return false; + } + } + return true; } }; return CMap; })(); // A special case of CMap, where the _map array implicitly has a length of -// 65535 and each element is equal to its index. +// 65536 and each element is equal to its index. var IdentityCMap = (function IdentityCMapClosure() { function IdentityCMap(vertical, n) { CMap.call(this); @@ -13515,7 +13535,11 @@ var IdentityCMap = (function IdentityCMapClosure() { return map; }, - readCharCode: CMap.prototype.readCharCode + readCharCode: CMap.prototype.readCharCode, + + get isIdentityCMap() { + error('should not access .isIdentityCMap'); + } }; return IdentityCMap; @@ -13980,6 +14004,13 @@ var CMapFactory = (function CMapFactoryClosure() { } } + function parseCMapName(cMap, lexer) { + var obj = lexer.getObj(); + if (isName(obj) && isString(obj.name)) { + cMap.name = obj.name; + } + } + function parseCMap(cMap, lexer, builtInCMapParams, useCMap) { var previous; var embededUseCMap; @@ -13990,6 +14021,8 @@ var CMapFactory = (function CMapFactoryClosure() { } else if (isName(obj)) { if (obj.name === 'WMode') { parseWMode(cMap, lexer); + } else if (obj.name === 'CMapName') { + parseCMapName(cMap, lexer); } previous = obj; } else if (isCmd(obj)) { @@ -14099,6 +14132,9 @@ var CMapFactory = (function CMapFactoryClosure() { } catch (e) { warn('Invalid CMap data. ' + e); } + if (cMap.isIdentityCMap) { + return createBuiltInCMap(cMap.name, builtInCMapParams); + } return cMap; } error('Encoding required.'); diff --git a/package.json b/package.json index 68027b8cd..40cbf9689 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pdfjs-dist", - "version": "1.1.86", + "version": "1.1.89", "description": "Generic build of Mozilla's PDF.js library.", "keywords": [ "Mozilla",