Browse Source

PDF.js version 1.7.250 - See mozilla/pdf.js@d842c9c6b040e726e74a25e9dae28eefa340efd8

master v1.7.250
Brendan Dahl 8 years ago
parent
commit
74f45fa9ba
  1. 2
      bower.json
  2. 72
      build/pdf.combined.js
  3. 72
      build/pdf.js
  4. 10
      build/pdf.min.js
  5. 4
      build/pdf.worker.js
  6. 2
      package.json

2
bower.json

@ -1,6 +1,6 @@
{ {
"name": "pdfjs-dist", "name": "pdfjs-dist",
"version": "1.7.248", "version": "1.7.250",
"main": [ "main": [
"build/pdf.js", "build/pdf.js",
"build/pdf.worker.js" "build/pdf.worker.js"

72
build/pdf.combined.js

@ -23,8 +23,8 @@
} }
}(this, function (exports) { }(this, function (exports) {
'use strict'; 'use strict';
var pdfjsVersion = '1.7.248'; var pdfjsVersion = '1.7.250';
var pdfjsBuild = '66304f7c'; var pdfjsBuild = 'd842c9c6';
var pdfjsFilePath = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : null; var pdfjsFilePath = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : null;
var pdfjsLibs = {}; var pdfjsLibs = {};
(function pdfjsWrapper() { (function pdfjsWrapper() {
@ -23180,11 +23180,34 @@
(function (root, factory) { (function (root, factory) {
factory(root.pdfjsDisplayDOMUtils = {}, root.pdfjsSharedUtil); factory(root.pdfjsDisplayDOMUtils = {}, root.pdfjsSharedUtil);
}(this, function (exports, sharedUtil) { }(this, function (exports, sharedUtil) {
var assert = sharedUtil.assert;
var removeNullCharacters = sharedUtil.removeNullCharacters; var removeNullCharacters = sharedUtil.removeNullCharacters;
var warn = sharedUtil.warn; var warn = sharedUtil.warn;
var deprecated = sharedUtil.deprecated; var deprecated = sharedUtil.deprecated;
var createValidAbsoluteUrl = sharedUtil.createValidAbsoluteUrl; var createValidAbsoluteUrl = sharedUtil.createValidAbsoluteUrl;
var DEFAULT_LINK_REL = 'noopener noreferrer nofollow'; var DEFAULT_LINK_REL = 'noopener noreferrer nofollow';
function DOMCanvasFactory() {
}
DOMCanvasFactory.prototype = {
create: function DOMCanvasFactory_create(width, height) {
assert(width > 0 && height > 0, 'invalid canvas size');
var canvas = document.createElement('canvas');
canvas.width = width;
canvas.height = height;
return canvas;
},
reset: function DOMCanvasFactory_reset(canvas, width, height) {
assert(canvas, 'canvas is not specified');
assert(width > 0 && height > 0, 'invalid canvas size');
canvas.width = width;
canvas.height = height;
},
destroy: function DOMCanvasFactory_destroy(canvas) {
assert(canvas, 'canvas is not specified');
canvas.width = 0;
canvas.height = 0;
}
};
var CustomStyle = function CustomStyleClosure() { var CustomStyle = function CustomStyleClosure() {
var prefixes = [ var prefixes = [
'ms', 'ms',
@ -23347,6 +23370,7 @@
exports.hasCanvasTypedArrays = hasCanvasTypedArrays; exports.hasCanvasTypedArrays = hasCanvasTypedArrays;
exports.getDefaultSetting = getDefaultSetting; exports.getDefaultSetting = getDefaultSetting;
exports.DEFAULT_LINK_REL = DEFAULT_LINK_REL; exports.DEFAULT_LINK_REL = DEFAULT_LINK_REL;
exports.DOMCanvasFactory = DOMCanvasFactory;
})); }));
(function (root, factory) { (function (root, factory) {
factory(root.pdfjsDisplayFontLoader = {}, root.pdfjsSharedUtil); factory(root.pdfjsDisplayFontLoader = {}, root.pdfjsSharedUtil);
@ -45433,12 +45457,6 @@
return shadow(IsLittleEndianCached, 'value', isLittleEndian()); return shadow(IsLittleEndianCached, 'value', isLittleEndian());
} }
}; };
function createScratchCanvas(width, height) {
var canvas = document.createElement('canvas');
canvas.width = width;
canvas.height = height;
return canvas;
}
function addContextCurrentTransform(ctx) { function addContextCurrentTransform(ctx) {
if (!ctx.mozCurrentTransform) { if (!ctx.mozCurrentTransform) {
ctx._originalSave = ctx.save; ctx._originalSave = ctx.save;
@ -45545,7 +45563,8 @@
} }
} }
var CachedCanvases = function CachedCanvasesClosure() { var CachedCanvases = function CachedCanvasesClosure() {
function CachedCanvases() { function CachedCanvases(canvasFactory) {
this.canvasFactory = canvasFactory;
this.cache = Object.create(null); this.cache = Object.create(null);
} }
CachedCanvases.prototype = { CachedCanvases.prototype = {
@ -45553,11 +45572,10 @@
var canvasEntry; var canvasEntry;
if (this.cache[id] !== undefined) { if (this.cache[id] !== undefined) {
canvasEntry = this.cache[id]; canvasEntry = this.cache[id];
canvasEntry.canvas.width = width; this.canvasFactory.reset(canvasEntry.canvas, width, height);
canvasEntry.canvas.height = height;
canvasEntry.context.setTransform(1, 0, 0, 1, 0, 0); canvasEntry.context.setTransform(1, 0, 0, 1, 0, 0);
} else { } else {
var canvas = createScratchCanvas(width, height); var canvas = this.canvasFactory.create(width, height);
var ctx = canvas.getContext('2d'); var ctx = canvas.getContext('2d');
if (trackTransform) { if (trackTransform) {
addContextCurrentTransform(ctx); addContextCurrentTransform(ctx);
@ -45572,8 +45590,7 @@
clear: function () { clear: function () {
for (var id in this.cache) { for (var id in this.cache) {
var canvasEntry = this.cache[id]; var canvasEntry = this.cache[id];
canvasEntry.canvas.width = 0; this.canvasFactory.destroy(canvasEntry.canvas);
canvasEntry.canvas.height = 0;
delete this.cache[id]; delete this.cache[id];
} }
} }
@ -45779,7 +45796,7 @@
var CanvasGraphics = function CanvasGraphicsClosure() { var CanvasGraphics = function CanvasGraphicsClosure() {
var EXECUTION_TIME = 15; var EXECUTION_TIME = 15;
var EXECUTION_STEPS = 10; var EXECUTION_STEPS = 10;
function CanvasGraphics(canvasCtx, commonObjs, objs, imageLayer) { function CanvasGraphics(canvasCtx, commonObjs, objs, canvasFactory, imageLayer) {
this.ctx = canvasCtx; this.ctx = canvasCtx;
this.current = new CanvasExtraState(); this.current = new CanvasExtraState();
this.stateStack = []; this.stateStack = [];
@ -45789,6 +45806,7 @@
this.xobjs = null; this.xobjs = null;
this.commonObjs = commonObjs; this.commonObjs = commonObjs;
this.objs = objs; this.objs = objs;
this.canvasFactory = canvasFactory;
this.imageLayer = imageLayer; this.imageLayer = imageLayer;
this.groupStack = []; this.groupStack = [];
this.processingType3 = null; this.processingType3 = null;
@ -45798,7 +45816,7 @@
this.smaskStack = []; this.smaskStack = [];
this.smaskCounter = 0; this.smaskCounter = 0;
this.tempSMask = null; this.tempSMask = null;
this.cachedCanvases = new CachedCanvases(); this.cachedCanvases = new CachedCanvases(this.canvasFactory);
if (canvasCtx) { if (canvasCtx) {
addContextCurrentTransform(canvasCtx); addContextCurrentTransform(canvasCtx);
} }
@ -46591,7 +46609,7 @@
} }
}, },
get isFontSubpixelAAEnabled() { get isFontSubpixelAAEnabled() {
var ctx = document.createElement('canvas').getContext('2d'); var ctx = this.canvasFactory.create(10, 10).getContext('2d');
ctx.scale(1.5, 1); ctx.scale(1.5, 1);
ctx.fillText('I', 0, 10); ctx.fillText('I', 0, 10);
var data = ctx.getImageData(0, 0, 10, 10).data; var data = ctx.getImageData(0, 0, 10, 10).data;
@ -46784,7 +46802,7 @@
var self = this; var self = this;
var canvasGraphicsFactory = { var canvasGraphicsFactory = {
createCanvasGraphics: function (ctx) { createCanvasGraphics: function (ctx) {
return new CanvasGraphics(ctx, self.commonObjs, self.objs); return new CanvasGraphics(ctx, self.commonObjs, self.objs, self.canvasFactory);
} }
}; };
pattern = new TilingPattern(IR, color, this.ctx, canvasGraphicsFactory, baseTransform); pattern = new TilingPattern(IR, color, this.ctx, canvasGraphicsFactory, baseTransform);
@ -47269,7 +47287,6 @@
return CanvasGraphics; return CanvasGraphics;
}(); }();
exports.CanvasGraphics = CanvasGraphics; exports.CanvasGraphics = CanvasGraphics;
exports.createScratchCanvas = createScratchCanvas;
})); }));
(function (root, factory) { (function (root, factory) {
factory(root.pdfjsCoreImage = {}, root.pdfjsSharedUtil, root.pdfjsCorePrimitives, root.pdfjsCoreColorSpace, root.pdfjsCoreStream, root.pdfjsCoreJpx); factory(root.pdfjsCoreImage = {}, root.pdfjsSharedUtil, root.pdfjsCorePrimitives, root.pdfjsCoreColorSpace, root.pdfjsCoreStream, root.pdfjsCoreJpx);
@ -50062,9 +50079,9 @@
var FontFaceObject = displayFontLoader.FontFaceObject; var FontFaceObject = displayFontLoader.FontFaceObject;
var FontLoader = displayFontLoader.FontLoader; var FontLoader = displayFontLoader.FontLoader;
var CanvasGraphics = displayCanvas.CanvasGraphics; var CanvasGraphics = displayCanvas.CanvasGraphics;
var createScratchCanvas = displayCanvas.createScratchCanvas;
var Metadata = displayMetadata.Metadata; var Metadata = displayMetadata.Metadata;
var getDefaultSetting = displayDOMUtils.getDefaultSetting; var getDefaultSetting = displayDOMUtils.getDefaultSetting;
var DOMCanvasFactory = displayDOMUtils.DOMCanvasFactory;
var DEFAULT_RANGE_CHUNK_SIZE = 65536; var DEFAULT_RANGE_CHUNK_SIZE = 65536;
var isWorkerDisabled = false; var isWorkerDisabled = false;
var workerSrc; var workerSrc;
@ -50379,6 +50396,7 @@
this.pendingCleanup = false; this.pendingCleanup = false;
var renderingIntent = params.intent === 'print' ? 'print' : 'display'; var renderingIntent = params.intent === 'print' ? 'print' : 'display';
var renderInteractiveForms = params.renderInteractiveForms === true ? true : false; var renderInteractiveForms = params.renderInteractiveForms === true ? true : false;
var canvasFactory = params.canvasFactory || new DOMCanvasFactory();
if (!this.intentStates[renderingIntent]) { if (!this.intentStates[renderingIntent]) {
this.intentStates[renderingIntent] = Object.create(null); this.intentStates[renderingIntent] = Object.create(null);
} }
@ -50398,7 +50416,7 @@
renderInteractiveForms: renderInteractiveForms renderInteractiveForms: renderInteractiveForms
}); });
} }
var internalRenderTask = new InternalRenderTask(complete, params, this.objs, this.commonObjs, intentState.operatorList, this.pageNumber); var internalRenderTask = new InternalRenderTask(complete, params, this.objs, this.commonObjs, intentState.operatorList, this.pageNumber, canvasFactory);
internalRenderTask.useRequestAnimationFrame = renderingIntent !== 'print'; internalRenderTask.useRequestAnimationFrame = renderingIntent !== 'print';
if (!intentState.renderTasks) { if (!intentState.renderTasks) {
intentState.renderTasks = []; intentState.renderTasks = [];
@ -50949,6 +50967,9 @@
if (this.destroyed) { if (this.destroyed) {
return Promise.reject(new Error('Worker was destroyed')); return Promise.reject(new Error('Worker was destroyed'));
} }
if (typeof document === 'undefined') {
return Promise.reject(new Error('"document" is not defined.'));
}
var imageUrl = data[0]; var imageUrl = data[0];
var components = data[1]; var components = data[1];
if (components !== 3 && components !== 1) { if (components !== 3 && components !== 1) {
@ -50962,7 +50983,9 @@
var size = width * height; var size = width * height;
var rgbaLength = size * 4; var rgbaLength = size * 4;
var buf = new Uint8Array(size * components); var buf = new Uint8Array(size * components);
var tmpCanvas = createScratchCanvas(width, height); var tmpCanvas = document.createElement('canvas');
tmpCanvas.width = width;
tmpCanvas.height = height;
var tmpCtx = tmpCanvas.getContext('2d'); var tmpCtx = tmpCanvas.getContext('2d');
tmpCtx.drawImage(img, 0, 0); tmpCtx.drawImage(img, 0, 0);
var data = tmpCtx.getImageData(0, 0, width, height).data; var data = tmpCtx.getImageData(0, 0, width, height).data;
@ -51144,7 +51167,7 @@
return RenderTask; return RenderTask;
}(); }();
var InternalRenderTask = function InternalRenderTaskClosure() { var InternalRenderTask = function InternalRenderTaskClosure() {
function InternalRenderTask(callback, params, objs, commonObjs, operatorList, pageNumber) { function InternalRenderTask(callback, params, objs, commonObjs, operatorList, pageNumber, canvasFactory) {
this.callback = callback; this.callback = callback;
this.params = params; this.params = params;
this.objs = objs; this.objs = objs;
@ -51152,6 +51175,7 @@
this.operatorListIdx = null; this.operatorListIdx = null;
this.operatorList = operatorList; this.operatorList = operatorList;
this.pageNumber = pageNumber; this.pageNumber = pageNumber;
this.canvasFactory = canvasFactory;
this.running = false; this.running = false;
this.graphicsReadyCallback = null; this.graphicsReadyCallback = null;
this.graphicsReady = false; this.graphicsReady = false;
@ -51174,7 +51198,7 @@
this.stepper.nextBreakPoint = this.stepper.getNextBreakPoint(); this.stepper.nextBreakPoint = this.stepper.getNextBreakPoint();
} }
var params = this.params; var params = this.params;
this.gfx = new CanvasGraphics(params.canvasContext, this.commonObjs, this.objs, params.imageLayer); this.gfx = new CanvasGraphics(params.canvasContext, this.commonObjs, this.objs, this.canvasFactory, params.imageLayer);
this.gfx.beginDrawing(params.transform, params.viewport, transparency); this.gfx.beginDrawing(params.transform, params.viewport, transparency);
this.operatorListIdx = 0; this.operatorListIdx = 0;
this.graphicsReady = true; this.graphicsReady = true;

72
build/pdf.js

@ -23,8 +23,8 @@
} }
}(this, function (exports) { }(this, function (exports) {
'use strict'; 'use strict';
var pdfjsVersion = '1.7.248'; var pdfjsVersion = '1.7.250';
var pdfjsBuild = '66304f7c'; var pdfjsBuild = 'd842c9c6';
var pdfjsFilePath = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : null; var pdfjsFilePath = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : null;
var pdfjsLibs = {}; var pdfjsLibs = {};
(function pdfjsWrapper() { (function pdfjsWrapper() {
@ -2251,11 +2251,34 @@
(function (root, factory) { (function (root, factory) {
factory(root.pdfjsDisplayDOMUtils = {}, root.pdfjsSharedUtil); factory(root.pdfjsDisplayDOMUtils = {}, root.pdfjsSharedUtil);
}(this, function (exports, sharedUtil) { }(this, function (exports, sharedUtil) {
var assert = sharedUtil.assert;
var removeNullCharacters = sharedUtil.removeNullCharacters; var removeNullCharacters = sharedUtil.removeNullCharacters;
var warn = sharedUtil.warn; var warn = sharedUtil.warn;
var deprecated = sharedUtil.deprecated; var deprecated = sharedUtil.deprecated;
var createValidAbsoluteUrl = sharedUtil.createValidAbsoluteUrl; var createValidAbsoluteUrl = sharedUtil.createValidAbsoluteUrl;
var DEFAULT_LINK_REL = 'noopener noreferrer nofollow'; var DEFAULT_LINK_REL = 'noopener noreferrer nofollow';
function DOMCanvasFactory() {
}
DOMCanvasFactory.prototype = {
create: function DOMCanvasFactory_create(width, height) {
assert(width > 0 && height > 0, 'invalid canvas size');
var canvas = document.createElement('canvas');
canvas.width = width;
canvas.height = height;
return canvas;
},
reset: function DOMCanvasFactory_reset(canvas, width, height) {
assert(canvas, 'canvas is not specified');
assert(width > 0 && height > 0, 'invalid canvas size');
canvas.width = width;
canvas.height = height;
},
destroy: function DOMCanvasFactory_destroy(canvas) {
assert(canvas, 'canvas is not specified');
canvas.width = 0;
canvas.height = 0;
}
};
var CustomStyle = function CustomStyleClosure() { var CustomStyle = function CustomStyleClosure() {
var prefixes = [ var prefixes = [
'ms', 'ms',
@ -2418,6 +2441,7 @@
exports.hasCanvasTypedArrays = hasCanvasTypedArrays; exports.hasCanvasTypedArrays = hasCanvasTypedArrays;
exports.getDefaultSetting = getDefaultSetting; exports.getDefaultSetting = getDefaultSetting;
exports.DEFAULT_LINK_REL = DEFAULT_LINK_REL; exports.DEFAULT_LINK_REL = DEFAULT_LINK_REL;
exports.DOMCanvasFactory = DOMCanvasFactory;
})); }));
(function (root, factory) { (function (root, factory) {
factory(root.pdfjsDisplayFontLoader = {}, root.pdfjsSharedUtil); factory(root.pdfjsDisplayFontLoader = {}, root.pdfjsSharedUtil);
@ -5718,12 +5742,6 @@
return shadow(IsLittleEndianCached, 'value', isLittleEndian()); return shadow(IsLittleEndianCached, 'value', isLittleEndian());
} }
}; };
function createScratchCanvas(width, height) {
var canvas = document.createElement('canvas');
canvas.width = width;
canvas.height = height;
return canvas;
}
function addContextCurrentTransform(ctx) { function addContextCurrentTransform(ctx) {
if (!ctx.mozCurrentTransform) { if (!ctx.mozCurrentTransform) {
ctx._originalSave = ctx.save; ctx._originalSave = ctx.save;
@ -5830,7 +5848,8 @@
} }
} }
var CachedCanvases = function CachedCanvasesClosure() { var CachedCanvases = function CachedCanvasesClosure() {
function CachedCanvases() { function CachedCanvases(canvasFactory) {
this.canvasFactory = canvasFactory;
this.cache = Object.create(null); this.cache = Object.create(null);
} }
CachedCanvases.prototype = { CachedCanvases.prototype = {
@ -5838,11 +5857,10 @@
var canvasEntry; var canvasEntry;
if (this.cache[id] !== undefined) { if (this.cache[id] !== undefined) {
canvasEntry = this.cache[id]; canvasEntry = this.cache[id];
canvasEntry.canvas.width = width; this.canvasFactory.reset(canvasEntry.canvas, width, height);
canvasEntry.canvas.height = height;
canvasEntry.context.setTransform(1, 0, 0, 1, 0, 0); canvasEntry.context.setTransform(1, 0, 0, 1, 0, 0);
} else { } else {
var canvas = createScratchCanvas(width, height); var canvas = this.canvasFactory.create(width, height);
var ctx = canvas.getContext('2d'); var ctx = canvas.getContext('2d');
if (trackTransform) { if (trackTransform) {
addContextCurrentTransform(ctx); addContextCurrentTransform(ctx);
@ -5857,8 +5875,7 @@
clear: function () { clear: function () {
for (var id in this.cache) { for (var id in this.cache) {
var canvasEntry = this.cache[id]; var canvasEntry = this.cache[id];
canvasEntry.canvas.width = 0; this.canvasFactory.destroy(canvasEntry.canvas);
canvasEntry.canvas.height = 0;
delete this.cache[id]; delete this.cache[id];
} }
} }
@ -6064,7 +6081,7 @@
var CanvasGraphics = function CanvasGraphicsClosure() { var CanvasGraphics = function CanvasGraphicsClosure() {
var EXECUTION_TIME = 15; var EXECUTION_TIME = 15;
var EXECUTION_STEPS = 10; var EXECUTION_STEPS = 10;
function CanvasGraphics(canvasCtx, commonObjs, objs, imageLayer) { function CanvasGraphics(canvasCtx, commonObjs, objs, canvasFactory, imageLayer) {
this.ctx = canvasCtx; this.ctx = canvasCtx;
this.current = new CanvasExtraState(); this.current = new CanvasExtraState();
this.stateStack = []; this.stateStack = [];
@ -6074,6 +6091,7 @@
this.xobjs = null; this.xobjs = null;
this.commonObjs = commonObjs; this.commonObjs = commonObjs;
this.objs = objs; this.objs = objs;
this.canvasFactory = canvasFactory;
this.imageLayer = imageLayer; this.imageLayer = imageLayer;
this.groupStack = []; this.groupStack = [];
this.processingType3 = null; this.processingType3 = null;
@ -6083,7 +6101,7 @@
this.smaskStack = []; this.smaskStack = [];
this.smaskCounter = 0; this.smaskCounter = 0;
this.tempSMask = null; this.tempSMask = null;
this.cachedCanvases = new CachedCanvases(); this.cachedCanvases = new CachedCanvases(this.canvasFactory);
if (canvasCtx) { if (canvasCtx) {
addContextCurrentTransform(canvasCtx); addContextCurrentTransform(canvasCtx);
} }
@ -6876,7 +6894,7 @@
} }
}, },
get isFontSubpixelAAEnabled() { get isFontSubpixelAAEnabled() {
var ctx = document.createElement('canvas').getContext('2d'); var ctx = this.canvasFactory.create(10, 10).getContext('2d');
ctx.scale(1.5, 1); ctx.scale(1.5, 1);
ctx.fillText('I', 0, 10); ctx.fillText('I', 0, 10);
var data = ctx.getImageData(0, 0, 10, 10).data; var data = ctx.getImageData(0, 0, 10, 10).data;
@ -7069,7 +7087,7 @@
var self = this; var self = this;
var canvasGraphicsFactory = { var canvasGraphicsFactory = {
createCanvasGraphics: function (ctx) { createCanvasGraphics: function (ctx) {
return new CanvasGraphics(ctx, self.commonObjs, self.objs); return new CanvasGraphics(ctx, self.commonObjs, self.objs, self.canvasFactory);
} }
}; };
pattern = new TilingPattern(IR, color, this.ctx, canvasGraphicsFactory, baseTransform); pattern = new TilingPattern(IR, color, this.ctx, canvasGraphicsFactory, baseTransform);
@ -7554,7 +7572,6 @@
return CanvasGraphics; return CanvasGraphics;
}(); }();
exports.CanvasGraphics = CanvasGraphics; exports.CanvasGraphics = CanvasGraphics;
exports.createScratchCanvas = createScratchCanvas;
})); }));
(function (root, factory) { (function (root, factory) {
factory(root.pdfjsDisplayAPI = {}, root.pdfjsSharedUtil, root.pdfjsDisplayFontLoader, root.pdfjsDisplayCanvas, root.pdfjsDisplayMetadata, root.pdfjsDisplayDOMUtils); factory(root.pdfjsDisplayAPI = {}, root.pdfjsSharedUtil, root.pdfjsDisplayFontLoader, root.pdfjsDisplayCanvas, root.pdfjsDisplayMetadata, root.pdfjsDisplayDOMUtils);
@ -7584,9 +7601,9 @@
var FontFaceObject = displayFontLoader.FontFaceObject; var FontFaceObject = displayFontLoader.FontFaceObject;
var FontLoader = displayFontLoader.FontLoader; var FontLoader = displayFontLoader.FontLoader;
var CanvasGraphics = displayCanvas.CanvasGraphics; var CanvasGraphics = displayCanvas.CanvasGraphics;
var createScratchCanvas = displayCanvas.createScratchCanvas;
var Metadata = displayMetadata.Metadata; var Metadata = displayMetadata.Metadata;
var getDefaultSetting = displayDOMUtils.getDefaultSetting; var getDefaultSetting = displayDOMUtils.getDefaultSetting;
var DOMCanvasFactory = displayDOMUtils.DOMCanvasFactory;
var DEFAULT_RANGE_CHUNK_SIZE = 65536; var DEFAULT_RANGE_CHUNK_SIZE = 65536;
var isWorkerDisabled = false; var isWorkerDisabled = false;
var workerSrc; var workerSrc;
@ -7925,6 +7942,7 @@
this.pendingCleanup = false; this.pendingCleanup = false;
var renderingIntent = params.intent === 'print' ? 'print' : 'display'; var renderingIntent = params.intent === 'print' ? 'print' : 'display';
var renderInteractiveForms = params.renderInteractiveForms === true ? true : false; var renderInteractiveForms = params.renderInteractiveForms === true ? true : false;
var canvasFactory = params.canvasFactory || new DOMCanvasFactory();
if (!this.intentStates[renderingIntent]) { if (!this.intentStates[renderingIntent]) {
this.intentStates[renderingIntent] = Object.create(null); this.intentStates[renderingIntent] = Object.create(null);
} }
@ -7944,7 +7962,7 @@
renderInteractiveForms: renderInteractiveForms renderInteractiveForms: renderInteractiveForms
}); });
} }
var internalRenderTask = new InternalRenderTask(complete, params, this.objs, this.commonObjs, intentState.operatorList, this.pageNumber); var internalRenderTask = new InternalRenderTask(complete, params, this.objs, this.commonObjs, intentState.operatorList, this.pageNumber, canvasFactory);
internalRenderTask.useRequestAnimationFrame = renderingIntent !== 'print'; internalRenderTask.useRequestAnimationFrame = renderingIntent !== 'print';
if (!intentState.renderTasks) { if (!intentState.renderTasks) {
intentState.renderTasks = []; intentState.renderTasks = [];
@ -8580,6 +8598,9 @@
if (this.destroyed) { if (this.destroyed) {
return Promise.reject(new Error('Worker was destroyed')); return Promise.reject(new Error('Worker was destroyed'));
} }
if (typeof document === 'undefined') {
return Promise.reject(new Error('"document" is not defined.'));
}
var imageUrl = data[0]; var imageUrl = data[0];
var components = data[1]; var components = data[1];
if (components !== 3 && components !== 1) { if (components !== 3 && components !== 1) {
@ -8593,7 +8614,9 @@
var size = width * height; var size = width * height;
var rgbaLength = size * 4; var rgbaLength = size * 4;
var buf = new Uint8Array(size * components); var buf = new Uint8Array(size * components);
var tmpCanvas = createScratchCanvas(width, height); var tmpCanvas = document.createElement('canvas');
tmpCanvas.width = width;
tmpCanvas.height = height;
var tmpCtx = tmpCanvas.getContext('2d'); var tmpCtx = tmpCanvas.getContext('2d');
tmpCtx.drawImage(img, 0, 0); tmpCtx.drawImage(img, 0, 0);
var data = tmpCtx.getImageData(0, 0, width, height).data; var data = tmpCtx.getImageData(0, 0, width, height).data;
@ -8775,7 +8798,7 @@
return RenderTask; return RenderTask;
}(); }();
var InternalRenderTask = function InternalRenderTaskClosure() { var InternalRenderTask = function InternalRenderTaskClosure() {
function InternalRenderTask(callback, params, objs, commonObjs, operatorList, pageNumber) { function InternalRenderTask(callback, params, objs, commonObjs, operatorList, pageNumber, canvasFactory) {
this.callback = callback; this.callback = callback;
this.params = params; this.params = params;
this.objs = objs; this.objs = objs;
@ -8783,6 +8806,7 @@
this.operatorListIdx = null; this.operatorListIdx = null;
this.operatorList = operatorList; this.operatorList = operatorList;
this.pageNumber = pageNumber; this.pageNumber = pageNumber;
this.canvasFactory = canvasFactory;
this.running = false; this.running = false;
this.graphicsReadyCallback = null; this.graphicsReadyCallback = null;
this.graphicsReady = false; this.graphicsReady = false;
@ -8805,7 +8829,7 @@
this.stepper.nextBreakPoint = this.stepper.getNextBreakPoint(); this.stepper.nextBreakPoint = this.stepper.getNextBreakPoint();
} }
var params = this.params; var params = this.params;
this.gfx = new CanvasGraphics(params.canvasContext, this.commonObjs, this.objs, params.imageLayer); this.gfx = new CanvasGraphics(params.canvasContext, this.commonObjs, this.objs, this.canvasFactory, params.imageLayer);
this.gfx.beginDrawing(params.transform, params.viewport, transparency); this.gfx.beginDrawing(params.transform, params.viewport, transparency);
this.operatorListIdx = 0; this.operatorListIdx = 0;
this.graphicsReady = true; this.graphicsReady = true;

10
build/pdf.min.js vendored

File diff suppressed because one or more lines are too long

4
build/pdf.worker.js vendored

@ -23,8 +23,8 @@
} }
}(this, function (exports) { }(this, function (exports) {
'use strict'; 'use strict';
var pdfjsVersion = '1.7.248'; var pdfjsVersion = '1.7.250';
var pdfjsBuild = '66304f7c'; var pdfjsBuild = 'd842c9c6';
var pdfjsFilePath = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : null; var pdfjsFilePath = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : null;
var pdfjsLibs = {}; var pdfjsLibs = {};
(function pdfjsWrapper() { (function pdfjsWrapper() {

2
package.json

@ -1,6 +1,6 @@
{ {
"name": "pdfjs-dist", "name": "pdfjs-dist",
"version": "1.7.248", "version": "1.7.250",
"main": "build/pdf.js", "main": "build/pdf.js",
"description": "Generic build of Mozilla's PDF.js library.", "description": "Generic build of Mozilla's PDF.js library.",
"keywords": [ "keywords": [

Loading…
Cancel
Save