Browse Source

PDF.js version 1.6.254 - See mozilla/pdf.js@273d2de6ec76706407b77abd105f48488102c8a7

master v1.6.254
Pdf Bot 8 years ago
parent
commit
d61c5ddb45
  1. 2
      bower.json
  2. 146
      build/pdf.combined.js
  3. 146
      build/pdf.js
  4. 4
      build/pdf.worker.js
  5. 2
      package.json

2
bower.json

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

146
build/pdf.combined.js

@ -24,8 +24,8 @@
}(this, function (exports) { }(this, function (exports) {
// Use strict in our context only - users might not want it // Use strict in our context only - users might not want it
'use strict'; 'use strict';
var pdfjsVersion = '1.6.250'; var pdfjsVersion = '1.6.254';
var pdfjsBuild = '960e344'; var pdfjsBuild = '273d2de';
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() {
@ -24900,15 +24900,6 @@
return SVGExtraState; return SVGExtraState;
}(); }();
var SVGGraphics = function SVGGraphicsClosure() { var SVGGraphics = function SVGGraphicsClosure() {
function createScratchSVG(width, height) {
var NS = 'http://www.w3.org/2000/svg';
var svg = document.createElementNS(NS, 'svg:svg');
svg.setAttributeNS(null, 'version', '1.1');
svg.setAttributeNS(null, 'width', width + 'px');
svg.setAttributeNS(null, 'height', height + 'px');
svg.setAttributeNS(null, 'viewBox', '0 0 ' + width + ' ' + height);
return svg;
}
function opListToTree(opList) { function opListToTree(opList) {
var opTree = []; var opTree = [];
var tmp = []; var tmp = [];
@ -25018,9 +25009,7 @@
restore: function SVGGraphics_restore() { restore: function SVGGraphics_restore() {
this.transformMatrix = this.transformStack.pop(); this.transformMatrix = this.transformStack.pop();
this.current = this.extraStack.pop(); this.current = this.extraStack.pop();
this.tgrp = document.createElementNS(NS, 'svg:g'); this.tgrp = null;
this.tgrp.setAttributeNS(null, 'transform', pm(this.transformMatrix));
this.pgrp.appendChild(this.tgrp);
}, },
group: function SVGGraphics_group(items) { group: function SVGGraphics_group(items) {
this.save(); this.save();
@ -25064,27 +25053,16 @@
f f
]; ];
this.transformMatrix = Util.transform(this.transformMatrix, transformMatrix); this.transformMatrix = Util.transform(this.transformMatrix, transformMatrix);
this.tgrp = document.createElementNS(NS, 'svg:g'); this.tgrp = null;
this.tgrp.setAttributeNS(null, 'transform', pm(this.transformMatrix));
}, },
getSVG: function SVGGraphics_getSVG(operatorList, viewport) { getSVG: function SVGGraphics_getSVG(operatorList, viewport) {
this.svg = createScratchSVG(viewport.width, viewport.height);
this.viewport = viewport; this.viewport = viewport;
var svgElement = this._initialize(viewport);
return this.loadDependencies(operatorList).then(function () { return this.loadDependencies(operatorList).then(function () {
this.transformMatrix = IDENTITY_MATRIX; this.transformMatrix = IDENTITY_MATRIX;
this.pgrp = document.createElementNS(NS, 'svg:g');
// Parent group
this.pgrp.setAttributeNS(null, 'transform', pm(viewport.transform));
this.tgrp = document.createElementNS(NS, 'svg:g');
// Transform group
this.tgrp.setAttributeNS(null, 'transform', pm(this.transformMatrix));
this.defs = document.createElementNS(NS, 'svg:defs');
this.pgrp.appendChild(this.defs);
this.pgrp.appendChild(this.tgrp);
this.svg.appendChild(this.pgrp);
var opTree = this.convertOpList(operatorList); var opTree = this.convertOpList(operatorList);
this.executeOpTree(opTree); this.executeOpTree(opTree);
return this.svg; return svgElement;
}.bind(this)); }.bind(this));
}, },
convertOpList: function SVGGraphics_convertOpList(operatorList) { convertOpList: function SVGGraphics_convertOpList(operatorList) {
@ -25240,7 +25218,7 @@
this.group(opTree[x].items); this.group(opTree[x].items);
break; break;
default: default:
warn('Unimplemented method ' + fn); warn('Unimplemented operator ' + fn);
break; break;
} }
} }
@ -25348,7 +25326,7 @@
current.txtElement.setAttributeNS(XML_NS, 'xml:space', 'preserve'); current.txtElement.setAttributeNS(XML_NS, 'xml:space', 'preserve');
current.txtElement.appendChild(current.tspan); current.txtElement.appendChild(current.tspan);
current.txtgrp.appendChild(current.txtElement); current.txtgrp.appendChild(current.txtElement);
this.tgrp.appendChild(current.txtElement); this._ensureTransformGroup().appendChild(current.txtElement);
}, },
setLeadingMoveText: function SVGGraphics_setLeadingMoveText(x, y) { setLeadingMoveText: function SVGGraphics_setLeadingMoveText(x, y) {
this.setLeading(-y); this.setLeading(-y);
@ -25390,14 +25368,6 @@
current.xcoords = []; current.xcoords = [];
}, },
endText: function SVGGraphics_endText() { endText: function SVGGraphics_endText() {
if (this.current.pendingClip) {
this.cgrp.appendChild(this.tgrp);
this.pgrp.appendChild(this.cgrp);
} else {
this.pgrp.appendChild(this.tgrp);
}
this.tgrp = document.createElementNS(NS, 'svg:g');
this.tgrp.setAttributeNS(null, 'transform', pm(this.transformMatrix));
}, },
// Path properties // Path properties
setLineWidth: function SVGGraphics_setLineWidth(width) { setLineWidth: function SVGGraphics_setLineWidth(width) {
@ -25484,28 +25454,13 @@
current.path.setAttributeNS(null, 'stroke-dasharray', current.dashArray.map(pf).join(' ')); current.path.setAttributeNS(null, 'stroke-dasharray', current.dashArray.map(pf).join(' '));
current.path.setAttributeNS(null, 'stroke-dashoffset', pf(current.dashPhase) + 'px'); current.path.setAttributeNS(null, 'stroke-dashoffset', pf(current.dashPhase) + 'px');
current.path.setAttributeNS(null, 'fill', 'none'); current.path.setAttributeNS(null, 'fill', 'none');
this.tgrp.appendChild(current.path); this._ensureTransformGroup().appendChild(current.path);
if (current.pendingClip) {
this.cgrp.appendChild(this.tgrp);
this.pgrp.appendChild(this.cgrp);
} else {
this.pgrp.appendChild(this.tgrp);
}
// Saving a reference in current.element so that it can be addressed // Saving a reference in current.element so that it can be addressed
// in 'fill' and 'stroke' // in 'fill' and 'stroke'
current.element = current.path; current.element = current.path;
current.setCurrentPoint(x, y); current.setCurrentPoint(x, y);
}, },
endPath: function SVGGraphics_endPath() { endPath: function SVGGraphics_endPath() {
var current = this.current;
if (current.pendingClip) {
this.cgrp.appendChild(this.tgrp);
this.pgrp.appendChild(this.cgrp);
} else {
this.pgrp.appendChild(this.tgrp);
}
this.tgrp = document.createElementNS(NS, 'svg:g');
this.tgrp.setAttributeNS(null, 'transform', pm(this.transformMatrix));
}, },
clip: function SVGGraphics_clip(type) { clip: function SVGGraphics_clip(type) {
var current = this.current; var current = this.current;
@ -25523,11 +25478,11 @@
this.clippath.setAttributeNS(null, 'transform', pm(this.transformMatrix)); this.clippath.setAttributeNS(null, 'transform', pm(this.transformMatrix));
this.clippath.appendChild(clipElement); this.clippath.appendChild(clipElement);
this.defs.appendChild(this.clippath); this.defs.appendChild(this.clippath);
// Create a new group with that attribute // Create a clipping group that references the clipping path.
current.pendingClip = true; current.pendingClip = true;
this.cgrp = document.createElementNS(NS, 'svg:g'); this.cgrp = document.createElementNS(NS, 'svg:g');
this.cgrp.setAttributeNS(null, 'clip-path', 'url(#' + current.clipId + ')'); this.cgrp.setAttributeNS(null, 'clip-path', 'url(#' + current.clipId + ')');
this.pgrp.appendChild(this.cgrp); this.svg.appendChild(this.cgrp);
}, },
closePath: function SVGGraphics_closePath() { closePath: function SVGGraphics_closePath() {
var current = this.current; var current = this.current;
@ -25565,20 +25520,11 @@
case 'D': case 'D':
this.setDash(value[0], value[1]); this.setDash(value[0], value[1]);
break; break;
case 'RI':
break;
case 'FL':
break;
case 'Font': case 'Font':
this.setFont(value); this.setFont(value);
break; break;
case 'CA': default:
break; warn('Unimplemented graphic state ' + key);
case 'ca':
break;
case 'BM':
break;
case 'SMask':
break; break;
} }
} }
@ -25623,10 +25569,9 @@
rect.setAttributeNS(null, 'width', '1px'); rect.setAttributeNS(null, 'width', '1px');
rect.setAttributeNS(null, 'height', '1px'); rect.setAttributeNS(null, 'height', '1px');
rect.setAttributeNS(null, 'fill', current.fillColor); rect.setAttributeNS(null, 'fill', current.fillColor);
this.tgrp.appendChild(rect); this._ensureTransformGroup().appendChild(rect);
}, },
paintJpegXObject: function SVGGraphics_paintJpegXObject(objId, w, h) { paintJpegXObject: function SVGGraphics_paintJpegXObject(objId, w, h) {
var current = this.current;
var imgObj = this.objs.get(objId); var imgObj = this.objs.get(objId);
var imgEl = document.createElementNS(NS, 'svg:image'); var imgEl = document.createElementNS(NS, 'svg:image');
imgEl.setAttributeNS(XLINK_NS, 'xlink:href', imgObj.src); imgEl.setAttributeNS(XLINK_NS, 'xlink:href', imgObj.src);
@ -25635,13 +25580,7 @@
imgEl.setAttributeNS(null, 'x', '0'); imgEl.setAttributeNS(null, 'x', '0');
imgEl.setAttributeNS(null, 'y', pf(-h)); imgEl.setAttributeNS(null, 'y', pf(-h));
imgEl.setAttributeNS(null, 'transform', 'scale(' + pf(1 / w) + ' ' + pf(-1 / h) + ')'); imgEl.setAttributeNS(null, 'transform', 'scale(' + pf(1 / w) + ' ' + pf(-1 / h) + ')');
this.tgrp.appendChild(imgEl); this._ensureTransformGroup().appendChild(imgEl);
if (current.pendingClip) {
this.cgrp.appendChild(this.tgrp);
this.pgrp.appendChild(this.cgrp);
} else {
this.pgrp.appendChild(this.tgrp);
}
}, },
paintImageXObject: function SVGGraphics_paintImageXObject(objId) { paintImageXObject: function SVGGraphics_paintImageXObject(objId) {
var imgData = this.objs.get(objId); var imgData = this.objs.get(objId);
@ -25652,7 +25591,6 @@
this.paintInlineImageXObject(imgData); this.paintInlineImageXObject(imgData);
}, },
paintInlineImageXObject: function SVGGraphics_paintInlineImageXObject(imgData, mask) { paintInlineImageXObject: function SVGGraphics_paintInlineImageXObject(imgData, mask) {
var current = this.current;
var width = imgData.width; var width = imgData.width;
var height = imgData.height; var height = imgData.height;
var imgSrc = convertImgDataToPng(imgData, this.forceDataSchema); var imgSrc = convertImgDataToPng(imgData, this.forceDataSchema);
@ -25661,7 +25599,7 @@
cliprect.setAttributeNS(null, 'y', '0'); cliprect.setAttributeNS(null, 'y', '0');
cliprect.setAttributeNS(null, 'width', pf(width)); cliprect.setAttributeNS(null, 'width', pf(width));
cliprect.setAttributeNS(null, 'height', pf(height)); cliprect.setAttributeNS(null, 'height', pf(height));
current.element = cliprect; this.current.element = cliprect;
this.clip('nonzero'); this.clip('nonzero');
var imgEl = document.createElementNS(NS, 'svg:image'); var imgEl = document.createElementNS(NS, 'svg:image');
imgEl.setAttributeNS(XLINK_NS, 'xlink:href', imgSrc); imgEl.setAttributeNS(XLINK_NS, 'xlink:href', imgSrc);
@ -25673,13 +25611,7 @@
if (mask) { if (mask) {
mask.appendChild(imgEl); mask.appendChild(imgEl);
} else { } else {
this.tgrp.appendChild(imgEl); this._ensureTransformGroup().appendChild(imgEl);
}
if (current.pendingClip) {
this.cgrp.appendChild(this.tgrp);
this.pgrp.appendChild(this.cgrp);
} else {
this.pgrp.appendChild(this.tgrp);
} }
}, },
paintImageMaskXObject: function SVGGraphics_paintImageMaskXObject(imgData) { paintImageMaskXObject: function SVGGraphics_paintImageMaskXObject(imgData) {
@ -25698,11 +25630,10 @@
rect.setAttributeNS(null, 'fill', fillColor); rect.setAttributeNS(null, 'fill', fillColor);
rect.setAttributeNS(null, 'mask', 'url(#' + current.maskId + ')'); rect.setAttributeNS(null, 'mask', 'url(#' + current.maskId + ')');
this.defs.appendChild(mask); this.defs.appendChild(mask);
this.tgrp.appendChild(rect); this._ensureTransformGroup().appendChild(rect);
this.paintInlineImageXObject(imgData, mask); this.paintInlineImageXObject(imgData, mask);
}, },
paintFormXObjectBegin: function SVGGraphics_paintFormXObjectBegin(matrix, bbox) { paintFormXObjectBegin: function SVGGraphics_paintFormXObjectBegin(matrix, bbox) {
this.save();
if (isArray(matrix) && matrix.length === 6) { if (isArray(matrix) && matrix.length === 6) {
this.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]); this.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
} }
@ -25720,7 +25651,46 @@
} }
}, },
paintFormXObjectEnd: function SVGGraphics_paintFormXObjectEnd() { paintFormXObjectEnd: function SVGGraphics_paintFormXObjectEnd() {
this.restore(); },
/**
* @private
*/
_initialize: function SVGGraphics_initialize(viewport) {
// Create the SVG element.
var svg = document.createElementNS(NS, 'svg:svg');
svg.setAttributeNS(null, 'version', '1.1');
svg.setAttributeNS(null, 'width', viewport.width + 'px');
svg.setAttributeNS(null, 'height', viewport.height + 'px');
svg.setAttributeNS(null, 'viewBox', '0 0 ' + viewport.width + ' ' + viewport.height);
// Create the definitions element.
var definitions = document.createElementNS(NS, 'svg:defs');
svg.appendChild(definitions);
this.defs = definitions;
// Create the root group element, which acts a container for all other
// groups and applies the viewport transform.
var rootGroup = document.createElementNS(NS, 'svg:g');
rootGroup.setAttributeNS(null, 'transform', pm(viewport.transform));
svg.appendChild(rootGroup);
// For the construction of the SVG image we are only interested in the
// root group, so we expose it as the entry point of the SVG image for
// the other code in this class.
this.svg = rootGroup;
return svg;
},
/**
* @private
*/
_ensureTransformGroup: function SVGGraphics_ensureTransformGroup() {
if (!this.tgrp) {
this.tgrp = document.createElementNS(NS, 'svg:g');
this.tgrp.setAttributeNS(null, 'transform', pm(this.transformMatrix));
if (this.current.pendingClip) {
this.cgrp.appendChild(this.tgrp);
} else {
this.svg.appendChild(this.tgrp);
}
}
return this.tgrp;
} }
}; };
return SVGGraphics; return SVGGraphics;

146
build/pdf.js

@ -24,8 +24,8 @@
}(this, function (exports) { }(this, function (exports) {
// Use strict in our context only - users might not want it // Use strict in our context only - users might not want it
'use strict'; 'use strict';
var pdfjsVersion = '1.6.250'; var pdfjsVersion = '1.6.254';
var pdfjsBuild = '960e344'; var pdfjsBuild = '273d2de';
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() {
@ -3295,15 +3295,6 @@
return SVGExtraState; return SVGExtraState;
}(); }();
var SVGGraphics = function SVGGraphicsClosure() { var SVGGraphics = function SVGGraphicsClosure() {
function createScratchSVG(width, height) {
var NS = 'http://www.w3.org/2000/svg';
var svg = document.createElementNS(NS, 'svg:svg');
svg.setAttributeNS(null, 'version', '1.1');
svg.setAttributeNS(null, 'width', width + 'px');
svg.setAttributeNS(null, 'height', height + 'px');
svg.setAttributeNS(null, 'viewBox', '0 0 ' + width + ' ' + height);
return svg;
}
function opListToTree(opList) { function opListToTree(opList) {
var opTree = []; var opTree = [];
var tmp = []; var tmp = [];
@ -3413,9 +3404,7 @@
restore: function SVGGraphics_restore() { restore: function SVGGraphics_restore() {
this.transformMatrix = this.transformStack.pop(); this.transformMatrix = this.transformStack.pop();
this.current = this.extraStack.pop(); this.current = this.extraStack.pop();
this.tgrp = document.createElementNS(NS, 'svg:g'); this.tgrp = null;
this.tgrp.setAttributeNS(null, 'transform', pm(this.transformMatrix));
this.pgrp.appendChild(this.tgrp);
}, },
group: function SVGGraphics_group(items) { group: function SVGGraphics_group(items) {
this.save(); this.save();
@ -3459,27 +3448,16 @@
f f
]; ];
this.transformMatrix = Util.transform(this.transformMatrix, transformMatrix); this.transformMatrix = Util.transform(this.transformMatrix, transformMatrix);
this.tgrp = document.createElementNS(NS, 'svg:g'); this.tgrp = null;
this.tgrp.setAttributeNS(null, 'transform', pm(this.transformMatrix));
}, },
getSVG: function SVGGraphics_getSVG(operatorList, viewport) { getSVG: function SVGGraphics_getSVG(operatorList, viewport) {
this.svg = createScratchSVG(viewport.width, viewport.height);
this.viewport = viewport; this.viewport = viewport;
var svgElement = this._initialize(viewport);
return this.loadDependencies(operatorList).then(function () { return this.loadDependencies(operatorList).then(function () {
this.transformMatrix = IDENTITY_MATRIX; this.transformMatrix = IDENTITY_MATRIX;
this.pgrp = document.createElementNS(NS, 'svg:g');
// Parent group
this.pgrp.setAttributeNS(null, 'transform', pm(viewport.transform));
this.tgrp = document.createElementNS(NS, 'svg:g');
// Transform group
this.tgrp.setAttributeNS(null, 'transform', pm(this.transformMatrix));
this.defs = document.createElementNS(NS, 'svg:defs');
this.pgrp.appendChild(this.defs);
this.pgrp.appendChild(this.tgrp);
this.svg.appendChild(this.pgrp);
var opTree = this.convertOpList(operatorList); var opTree = this.convertOpList(operatorList);
this.executeOpTree(opTree); this.executeOpTree(opTree);
return this.svg; return svgElement;
}.bind(this)); }.bind(this));
}, },
convertOpList: function SVGGraphics_convertOpList(operatorList) { convertOpList: function SVGGraphics_convertOpList(operatorList) {
@ -3635,7 +3613,7 @@
this.group(opTree[x].items); this.group(opTree[x].items);
break; break;
default: default:
warn('Unimplemented method ' + fn); warn('Unimplemented operator ' + fn);
break; break;
} }
} }
@ -3743,7 +3721,7 @@
current.txtElement.setAttributeNS(XML_NS, 'xml:space', 'preserve'); current.txtElement.setAttributeNS(XML_NS, 'xml:space', 'preserve');
current.txtElement.appendChild(current.tspan); current.txtElement.appendChild(current.tspan);
current.txtgrp.appendChild(current.txtElement); current.txtgrp.appendChild(current.txtElement);
this.tgrp.appendChild(current.txtElement); this._ensureTransformGroup().appendChild(current.txtElement);
}, },
setLeadingMoveText: function SVGGraphics_setLeadingMoveText(x, y) { setLeadingMoveText: function SVGGraphics_setLeadingMoveText(x, y) {
this.setLeading(-y); this.setLeading(-y);
@ -3785,14 +3763,6 @@
current.xcoords = []; current.xcoords = [];
}, },
endText: function SVGGraphics_endText() { endText: function SVGGraphics_endText() {
if (this.current.pendingClip) {
this.cgrp.appendChild(this.tgrp);
this.pgrp.appendChild(this.cgrp);
} else {
this.pgrp.appendChild(this.tgrp);
}
this.tgrp = document.createElementNS(NS, 'svg:g');
this.tgrp.setAttributeNS(null, 'transform', pm(this.transformMatrix));
}, },
// Path properties // Path properties
setLineWidth: function SVGGraphics_setLineWidth(width) { setLineWidth: function SVGGraphics_setLineWidth(width) {
@ -3879,28 +3849,13 @@
current.path.setAttributeNS(null, 'stroke-dasharray', current.dashArray.map(pf).join(' ')); current.path.setAttributeNS(null, 'stroke-dasharray', current.dashArray.map(pf).join(' '));
current.path.setAttributeNS(null, 'stroke-dashoffset', pf(current.dashPhase) + 'px'); current.path.setAttributeNS(null, 'stroke-dashoffset', pf(current.dashPhase) + 'px');
current.path.setAttributeNS(null, 'fill', 'none'); current.path.setAttributeNS(null, 'fill', 'none');
this.tgrp.appendChild(current.path); this._ensureTransformGroup().appendChild(current.path);
if (current.pendingClip) {
this.cgrp.appendChild(this.tgrp);
this.pgrp.appendChild(this.cgrp);
} else {
this.pgrp.appendChild(this.tgrp);
}
// Saving a reference in current.element so that it can be addressed // Saving a reference in current.element so that it can be addressed
// in 'fill' and 'stroke' // in 'fill' and 'stroke'
current.element = current.path; current.element = current.path;
current.setCurrentPoint(x, y); current.setCurrentPoint(x, y);
}, },
endPath: function SVGGraphics_endPath() { endPath: function SVGGraphics_endPath() {
var current = this.current;
if (current.pendingClip) {
this.cgrp.appendChild(this.tgrp);
this.pgrp.appendChild(this.cgrp);
} else {
this.pgrp.appendChild(this.tgrp);
}
this.tgrp = document.createElementNS(NS, 'svg:g');
this.tgrp.setAttributeNS(null, 'transform', pm(this.transformMatrix));
}, },
clip: function SVGGraphics_clip(type) { clip: function SVGGraphics_clip(type) {
var current = this.current; var current = this.current;
@ -3918,11 +3873,11 @@
this.clippath.setAttributeNS(null, 'transform', pm(this.transformMatrix)); this.clippath.setAttributeNS(null, 'transform', pm(this.transformMatrix));
this.clippath.appendChild(clipElement); this.clippath.appendChild(clipElement);
this.defs.appendChild(this.clippath); this.defs.appendChild(this.clippath);
// Create a new group with that attribute // Create a clipping group that references the clipping path.
current.pendingClip = true; current.pendingClip = true;
this.cgrp = document.createElementNS(NS, 'svg:g'); this.cgrp = document.createElementNS(NS, 'svg:g');
this.cgrp.setAttributeNS(null, 'clip-path', 'url(#' + current.clipId + ')'); this.cgrp.setAttributeNS(null, 'clip-path', 'url(#' + current.clipId + ')');
this.pgrp.appendChild(this.cgrp); this.svg.appendChild(this.cgrp);
}, },
closePath: function SVGGraphics_closePath() { closePath: function SVGGraphics_closePath() {
var current = this.current; var current = this.current;
@ -3960,20 +3915,11 @@
case 'D': case 'D':
this.setDash(value[0], value[1]); this.setDash(value[0], value[1]);
break; break;
case 'RI':
break;
case 'FL':
break;
case 'Font': case 'Font':
this.setFont(value); this.setFont(value);
break; break;
case 'CA': default:
break; warn('Unimplemented graphic state ' + key);
case 'ca':
break;
case 'BM':
break;
case 'SMask':
break; break;
} }
} }
@ -4018,10 +3964,9 @@
rect.setAttributeNS(null, 'width', '1px'); rect.setAttributeNS(null, 'width', '1px');
rect.setAttributeNS(null, 'height', '1px'); rect.setAttributeNS(null, 'height', '1px');
rect.setAttributeNS(null, 'fill', current.fillColor); rect.setAttributeNS(null, 'fill', current.fillColor);
this.tgrp.appendChild(rect); this._ensureTransformGroup().appendChild(rect);
}, },
paintJpegXObject: function SVGGraphics_paintJpegXObject(objId, w, h) { paintJpegXObject: function SVGGraphics_paintJpegXObject(objId, w, h) {
var current = this.current;
var imgObj = this.objs.get(objId); var imgObj = this.objs.get(objId);
var imgEl = document.createElementNS(NS, 'svg:image'); var imgEl = document.createElementNS(NS, 'svg:image');
imgEl.setAttributeNS(XLINK_NS, 'xlink:href', imgObj.src); imgEl.setAttributeNS(XLINK_NS, 'xlink:href', imgObj.src);
@ -4030,13 +3975,7 @@
imgEl.setAttributeNS(null, 'x', '0'); imgEl.setAttributeNS(null, 'x', '0');
imgEl.setAttributeNS(null, 'y', pf(-h)); imgEl.setAttributeNS(null, 'y', pf(-h));
imgEl.setAttributeNS(null, 'transform', 'scale(' + pf(1 / w) + ' ' + pf(-1 / h) + ')'); imgEl.setAttributeNS(null, 'transform', 'scale(' + pf(1 / w) + ' ' + pf(-1 / h) + ')');
this.tgrp.appendChild(imgEl); this._ensureTransformGroup().appendChild(imgEl);
if (current.pendingClip) {
this.cgrp.appendChild(this.tgrp);
this.pgrp.appendChild(this.cgrp);
} else {
this.pgrp.appendChild(this.tgrp);
}
}, },
paintImageXObject: function SVGGraphics_paintImageXObject(objId) { paintImageXObject: function SVGGraphics_paintImageXObject(objId) {
var imgData = this.objs.get(objId); var imgData = this.objs.get(objId);
@ -4047,7 +3986,6 @@
this.paintInlineImageXObject(imgData); this.paintInlineImageXObject(imgData);
}, },
paintInlineImageXObject: function SVGGraphics_paintInlineImageXObject(imgData, mask) { paintInlineImageXObject: function SVGGraphics_paintInlineImageXObject(imgData, mask) {
var current = this.current;
var width = imgData.width; var width = imgData.width;
var height = imgData.height; var height = imgData.height;
var imgSrc = convertImgDataToPng(imgData, this.forceDataSchema); var imgSrc = convertImgDataToPng(imgData, this.forceDataSchema);
@ -4056,7 +3994,7 @@
cliprect.setAttributeNS(null, 'y', '0'); cliprect.setAttributeNS(null, 'y', '0');
cliprect.setAttributeNS(null, 'width', pf(width)); cliprect.setAttributeNS(null, 'width', pf(width));
cliprect.setAttributeNS(null, 'height', pf(height)); cliprect.setAttributeNS(null, 'height', pf(height));
current.element = cliprect; this.current.element = cliprect;
this.clip('nonzero'); this.clip('nonzero');
var imgEl = document.createElementNS(NS, 'svg:image'); var imgEl = document.createElementNS(NS, 'svg:image');
imgEl.setAttributeNS(XLINK_NS, 'xlink:href', imgSrc); imgEl.setAttributeNS(XLINK_NS, 'xlink:href', imgSrc);
@ -4068,13 +4006,7 @@
if (mask) { if (mask) {
mask.appendChild(imgEl); mask.appendChild(imgEl);
} else { } else {
this.tgrp.appendChild(imgEl); this._ensureTransformGroup().appendChild(imgEl);
}
if (current.pendingClip) {
this.cgrp.appendChild(this.tgrp);
this.pgrp.appendChild(this.cgrp);
} else {
this.pgrp.appendChild(this.tgrp);
} }
}, },
paintImageMaskXObject: function SVGGraphics_paintImageMaskXObject(imgData) { paintImageMaskXObject: function SVGGraphics_paintImageMaskXObject(imgData) {
@ -4093,11 +4025,10 @@
rect.setAttributeNS(null, 'fill', fillColor); rect.setAttributeNS(null, 'fill', fillColor);
rect.setAttributeNS(null, 'mask', 'url(#' + current.maskId + ')'); rect.setAttributeNS(null, 'mask', 'url(#' + current.maskId + ')');
this.defs.appendChild(mask); this.defs.appendChild(mask);
this.tgrp.appendChild(rect); this._ensureTransformGroup().appendChild(rect);
this.paintInlineImageXObject(imgData, mask); this.paintInlineImageXObject(imgData, mask);
}, },
paintFormXObjectBegin: function SVGGraphics_paintFormXObjectBegin(matrix, bbox) { paintFormXObjectBegin: function SVGGraphics_paintFormXObjectBegin(matrix, bbox) {
this.save();
if (isArray(matrix) && matrix.length === 6) { if (isArray(matrix) && matrix.length === 6) {
this.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]); this.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
} }
@ -4115,7 +4046,46 @@
} }
}, },
paintFormXObjectEnd: function SVGGraphics_paintFormXObjectEnd() { paintFormXObjectEnd: function SVGGraphics_paintFormXObjectEnd() {
this.restore(); },
/**
* @private
*/
_initialize: function SVGGraphics_initialize(viewport) {
// Create the SVG element.
var svg = document.createElementNS(NS, 'svg:svg');
svg.setAttributeNS(null, 'version', '1.1');
svg.setAttributeNS(null, 'width', viewport.width + 'px');
svg.setAttributeNS(null, 'height', viewport.height + 'px');
svg.setAttributeNS(null, 'viewBox', '0 0 ' + viewport.width + ' ' + viewport.height);
// Create the definitions element.
var definitions = document.createElementNS(NS, 'svg:defs');
svg.appendChild(definitions);
this.defs = definitions;
// Create the root group element, which acts a container for all other
// groups and applies the viewport transform.
var rootGroup = document.createElementNS(NS, 'svg:g');
rootGroup.setAttributeNS(null, 'transform', pm(viewport.transform));
svg.appendChild(rootGroup);
// For the construction of the SVG image we are only interested in the
// root group, so we expose it as the entry point of the SVG image for
// the other code in this class.
this.svg = rootGroup;
return svg;
},
/**
* @private
*/
_ensureTransformGroup: function SVGGraphics_ensureTransformGroup() {
if (!this.tgrp) {
this.tgrp = document.createElementNS(NS, 'svg:g');
this.tgrp.setAttributeNS(null, 'transform', pm(this.transformMatrix));
if (this.current.pendingClip) {
this.cgrp.appendChild(this.tgrp);
} else {
this.svg.appendChild(this.tgrp);
}
}
return this.tgrp;
} }
}; };
return SVGGraphics; return SVGGraphics;

4
build/pdf.worker.js vendored

@ -24,8 +24,8 @@
}(this, function (exports) { }(this, function (exports) {
// Use strict in our context only - users might not want it // Use strict in our context only - users might not want it
'use strict'; 'use strict';
var pdfjsVersion = '1.6.250'; var pdfjsVersion = '1.6.254';
var pdfjsBuild = '960e344'; var pdfjsBuild = '273d2de';
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.6.250", "version": "1.6.254",
"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