mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Prevent CMapFactory.create from failing by passing the necessary parameters from PartialEvaluator_readToUnicode (issue 5010)
This commit is contained in:
parent
2e98f9095e
commit
04975acceb
5 changed files with 16 additions and 4 deletions
|
@ -815,7 +815,7 @@ var CMapFactory = (function CMapFactoryClosure() {
|
|||
if (BUILT_IN_CMAPS.indexOf(name) === -1) {
|
||||
error('Unknown cMap name: ' + name);
|
||||
}
|
||||
assert (builtInCMapParams, 'buildin cmap parameters are not provided');
|
||||
assert(builtInCMapParams, 'built-in cMap parameters are not provided');
|
||||
|
||||
if (builtInCMapParams.packed) {
|
||||
return parseBinaryCMap(name, builtInCMapParams);
|
||||
|
|
|
@ -1224,7 +1224,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||
// 9.10.2
|
||||
var toUnicode = (dict.get('ToUnicode') || baseDict.get('ToUnicode'));
|
||||
if (toUnicode) {
|
||||
properties.toUnicode = this.readToUnicode(toUnicode, xref, properties);
|
||||
properties.toUnicode = this.readToUnicode(toUnicode);
|
||||
}
|
||||
if (properties.composite) {
|
||||
// CIDSystemInfo helps to match CID to glyphs
|
||||
|
@ -1308,9 +1308,11 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||
readToUnicode: function PartialEvaluator_readToUnicode(toUnicode) {
|
||||
var cmapObj = toUnicode;
|
||||
if (isName(cmapObj)) {
|
||||
return CMapFactory.create(cmapObj).map;
|
||||
return CMapFactory.create(cmapObj,
|
||||
{ url: PDFJS.cMapUrl, packed: PDFJS.cMapPacked }, null).map;
|
||||
} else if (isStream(cmapObj)) {
|
||||
var cmap = CMapFactory.create(cmapObj).map;
|
||||
var cmap = CMapFactory.create(cmapObj,
|
||||
{ url: PDFJS.cMapUrl, packed: PDFJS.cMapPacked }, null).map;
|
||||
// Convert UTF-16BE
|
||||
// NOTE: cmap can be a sparse array, so use forEach instead of for(;;)
|
||||
// to iterate over all keys.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue