|
|
@ -19,6 +19,7 @@ function warn(msg) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function error(msg) { |
|
|
|
function error(msg) { |
|
|
|
|
|
|
|
log(backtrace()); |
|
|
|
throw new Error(msg); |
|
|
|
throw new Error(msg); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -43,6 +44,16 @@ function assertWellFormed(cond, msg) { |
|
|
|
malformed(msg); |
|
|
|
malformed(msg); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function backtrace() { |
|
|
|
|
|
|
|
var stackStr; |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
throw new Error(); |
|
|
|
|
|
|
|
} catch(e) { |
|
|
|
|
|
|
|
stackStr = e.stack; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
return stackStr.split('\n').slice(1).join('\n'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function shadow(obj, prop, value) { |
|
|
|
function shadow(obj, prop, value) { |
|
|
|
Object.defineProperty(obj, prop, { value: value, enumerable: true, configurable: true, writable: false }); |
|
|
|
Object.defineProperty(obj, prop, { value: value, enumerable: true, configurable: true, writable: false }); |
|
|
|
return value; |
|
|
|
return value; |
|
|
@ -2963,7 +2974,7 @@ var Page = (function() { |
|
|
|
return shadow(this, 'mediaBox', |
|
|
|
return shadow(this, 'mediaBox', |
|
|
|
((IsArray(obj) && obj.length == 4) ? obj : null)); |
|
|
|
((IsArray(obj) && obj.length == 4) ? obj : null)); |
|
|
|
}, |
|
|
|
}, |
|
|
|
startRendering: function(canvasCtx, continuation) { |
|
|
|
startRendering: function(canvasCtx, continuation, onerror) { |
|
|
|
var self = this; |
|
|
|
var self = this; |
|
|
|
var stats = self.stats; |
|
|
|
var stats = self.stats; |
|
|
|
stats.compile = stats.fonts = stats.render = 0; |
|
|
|
stats.compile = stats.fonts = stats.render = 0; |
|
|
@ -2981,9 +2992,14 @@ var Page = (function() { |
|
|
|
// Always defer call to display() to work around bug in
|
|
|
|
// Always defer call to display() to work around bug in
|
|
|
|
// Firefox error reporting from XHR callbacks.
|
|
|
|
// Firefox error reporting from XHR callbacks.
|
|
|
|
setTimeout(function () { |
|
|
|
setTimeout(function () { |
|
|
|
self.display(gfx); |
|
|
|
var exc = null; |
|
|
|
stats.render = Date.now(); |
|
|
|
try { |
|
|
|
continuation(); |
|
|
|
self.display(gfx); |
|
|
|
|
|
|
|
stats.render = Date.now(); |
|
|
|
|
|
|
|
} catch (e) { |
|
|
|
|
|
|
|
exc = e.toString(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
continuation(exc); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
@ -3642,7 +3658,12 @@ var PartialEvaluator = (function() { |
|
|
|
if (!df) |
|
|
|
if (!df) |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
compositeFont = true; |
|
|
|
compositeFont = true; |
|
|
|
descendant = xref.fetch(df[0]); |
|
|
|
|
|
|
|
|
|
|
|
if (IsRef(df)) { |
|
|
|
|
|
|
|
df = xref.fetch(df); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
descendant = xref.fetch(IsRef(df) ? df : df[0]); |
|
|
|
subType = descendant.get('Subtype'); |
|
|
|
subType = descendant.get('Subtype'); |
|
|
|
fd = descendant.get('FontDescriptor'); |
|
|
|
fd = descendant.get('FontDescriptor'); |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -4857,10 +4878,10 @@ var ColorSpace = (function() { |
|
|
|
case 'Lab': |
|
|
|
case 'Lab': |
|
|
|
case 'DeviceN': |
|
|
|
case 'DeviceN': |
|
|
|
default: |
|
|
|
default: |
|
|
|
error("unrecognized color space object '" + mode + "'"); |
|
|
|
error("unimplemented color space object '" + mode + "'"); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
error('unrecognized color space object'); |
|
|
|
error('unrecognized color space object: "'+ cs +"'"); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@ -5134,6 +5155,10 @@ var PDFImage = (function() { |
|
|
|
this.bpc = bitsPerComponent; |
|
|
|
this.bpc = bitsPerComponent; |
|
|
|
|
|
|
|
|
|
|
|
var colorSpace = dict.get('ColorSpace', 'CS'); |
|
|
|
var colorSpace = dict.get('ColorSpace', 'CS'); |
|
|
|
|
|
|
|
if (!colorSpace) { |
|
|
|
|
|
|
|
TODO('JPX images (which don"t require color spaces'); |
|
|
|
|
|
|
|
colorSpace = new Name('DeviceRGB'); |
|
|
|
|
|
|
|
} |
|
|
|
this.colorSpace = ColorSpace.parse(colorSpace, xref, res); |
|
|
|
this.colorSpace = ColorSpace.parse(colorSpace, xref, res); |
|
|
|
|
|
|
|
|
|
|
|
this.numComps = this.colorSpace.numComps; |
|
|
|
this.numComps = this.colorSpace.numComps; |
|
|
|