diff --git a/src/evaluator.js b/src/evaluator.js index 1327b3a69..5007394b4 100644 --- a/src/evaluator.js +++ b/src/evaluator.js @@ -246,7 +246,7 @@ var PartialEvaluator = (function partialEvaluator() { } var fnArray = queue.fnArray, argsArray = queue.argsArray; - var dependency = dependency || []; + var dependencyArray = dependency || []; resources = xref.fetchIfRef(resources) || new Dict(); var xobjs = xref.fetchIfRef(resources.get('XObject')) || new Dict(); @@ -293,13 +293,14 @@ var PartialEvaluator = (function partialEvaluator() { if (typeNum == TILING_PATTERN) { // Create an IR of the pattern code. - var depIdx = dependency.length; - var codeIR = this.getIRQueue(pattern, - dict.get('Resources'), {}, dependency); + var depIdx = dependencyArray.length; + var queueObj = {}; + var codeIR = this.getIRQueue(pattern, dict.get('Resources'), + queueObj, dependencyArray); // Add the dependencies that are required to execute the // codeIR. - insertDependency(dependency.slice(depIdx)); + insertDependency(dependencyArray.slice(depIdx)); args = TilingPattern.getIR(codeIR, dict, args); } @@ -336,14 +337,14 @@ var PartialEvaluator = (function partialEvaluator() { argsArray.push([matrix, bbox]); // This adds the IRQueue of the xObj to the current queue. - var depIdx = dependency.length; + var depIdx = dependencyArray.length; this.getIRQueue(xobj, xobj.dict.get('Resources'), queue, - dependency); + dependencyArray); // Add the dependencies that are required to execute the // codeIR. - insertDependency(dependency.slice(depIdx)); + insertDependency(dependencyArray.slice(depIdx)); fn = 'paintFormXObjectEnd'; args = []; @@ -875,9 +876,11 @@ var PartialEvaluator = (function partialEvaluator() { properties.resources = fontResources; for (var key in charProcs.map) { var glyphStream = xref.fetchIfRef(charProcs.map[key]); - var queue = {}; + var queueObj = {}; properties.glyphs[key].IRQueue = this.getIRQueue(glyphStream, - fontResources, queue, dependency); + fontResources, + queueObj, + dependency); } } diff --git a/src/fonts.js b/src/fonts.js index 1663fe750..f123b5f4c 100644 --- a/src/fonts.js +++ b/src/fonts.js @@ -2897,7 +2897,8 @@ var Type2CFF = (function type2CFF() { if (unicode <= 0x1f || (unicode >= 127 && unicode <= 255)) unicode += kCmapGlyphOffset; - var width = isNum(mapping.width) ? mapping.width : defaultWidth; + var width = (mapping.hasOwnProperty('width') && isNum(mapping.width)) ? + mapping.width : defaultWidth; properties.encoding[code] = { unicode: unicode, width: width diff --git a/src/function.js b/src/function.js index 0f0ec8643..0d4976ab0 100644 --- a/src/function.js +++ b/src/function.js @@ -64,6 +64,7 @@ var PDFFunction = (function() { case CONSTRUCT_STICHED: return this.constructStichedFromIR(IR); case CONSTRUCT_POSTSCRIPT: + default: return this.constructPostScriptFromIR(IR); } }, diff --git a/src/obj.js b/src/obj.js index 8716d465d..03fbf2e0a 100644 --- a/src/obj.js +++ b/src/obj.js @@ -675,7 +675,7 @@ var PDFObjects = (function() { // not required to be resolved right now if (callback) { this.ensureObj(objId).then(callback); - return; + return null; } // If there isn't a callback, the user expects to get the resolved data @@ -684,10 +684,12 @@ var PDFObjects = (function() { // If there isn't an object yet or the object isn't resolved, then the // data isn't ready yet! - if (!obj || !obj.isResolved) + if (!obj || !obj.isResolved) { throw 'Requesting object that isn\'t resolved yet ' + objId; - else + return null; + } else { return obj.data; + } }, /** diff --git a/src/parser.js b/src/parser.js index 677eaad94..79a336d7f 100644 --- a/src/parser.js +++ b/src/parser.js @@ -244,7 +244,7 @@ var Parser = (function parserParser() { } else if (name == 'CCITTFaxDecode' || name == 'CCF') { return new CCITTFaxStream(stream, params); } else { - error('filter "' + name + '" not supported yet'); + TODO('filter "' + name + '" not supported yet'); } return stream; }