Browse Source

PDF.js version 1.9.549 - See mozilla/pdf.js@320779e6edcf7b6528a3fd22e742837293b63398

master v1.9.549
pdfjsbot 7 years ago
parent
commit
ac3d18d7bb
  1. 2
      bower.json
  2. 410
      build/pdf.combined.js
  3. 2
      build/pdf.combined.js.map
  4. 312
      build/pdf.js
  5. 2
      build/pdf.js.map
  6. 2
      build/pdf.min.js
  7. 102
      build/pdf.worker.js
  8. 2
      build/pdf.worker.js.map
  9. 2
      build/pdf.worker.min.js
  10. 98
      lib/core/annotation.js
  11. 140
      lib/display/annotation_layer.js
  12. 4
      lib/display/api.js
  13. 34
      lib/display/dom_utils.js
  14. 4
      lib/display/global.js
  15. 58
      lib/display/svg.js
  16. 4
      lib/pdf.js
  17. 4
      lib/pdf.worker.js
  18. 44
      lib/test/unit/dom_utils_spec.js
  19. 2
      package.json
  20. 2
      web/pdf_viewer.css

2
bower.json

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

410
build/pdf.combined.js

@ -3455,7 +3455,7 @@ module.exports = !__w_pdfjs_require__(19)(function () { @@ -3455,7 +3455,7 @@ module.exports = !__w_pdfjs_require__(19)(function () {
"use strict";
var dP = __w_pdfjs_require__(9);
var dP = __w_pdfjs_require__(10);
var createDesc = __w_pdfjs_require__(22);
module.exports = __w_pdfjs_require__(5) ? function (object, key, value) {
return dP.f(object, key, createDesc(1, value));
@ -3496,33 +3496,10 @@ module.exports = function (it) { @@ -3496,33 +3496,10 @@ module.exports = function (it) {
"use strict";
var anObject = __w_pdfjs_require__(21);
var IE8_DOM_DEFINE = __w_pdfjs_require__(38);
var toPrimitive = __w_pdfjs_require__(27);
var dP = Object.defineProperty;
exports.f = __w_pdfjs_require__(5) ? Object.defineProperty : function defineProperty(O, P, Attributes) {
anObject(O);
P = toPrimitive(P, true);
anObject(Attributes);
if (IE8_DOM_DEFINE) try {
return dP(O, P, Attributes);
} catch (e) {}
if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
if ('value' in Attributes) O[P] = Attributes.value;
return O;
};
/***/ }),
/* 10 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.DOMCMapReaderFactory = exports.DOMCanvasFactory = exports.DEFAULT_LINK_REL = exports.getDefaultSetting = exports.LinkTarget = exports.getFilenameFromUrl = exports.isValidUrl = exports.isExternalLinkTargetSet = exports.addLinkAttributes = exports.RenderingCancelledException = exports.CustomStyle = undefined;
exports.DOMSVGFactory = exports.DOMCMapReaderFactory = exports.DOMCanvasFactory = exports.DEFAULT_LINK_REL = exports.getDefaultSetting = exports.LinkTarget = exports.getFilenameFromUrl = exports.isValidUrl = exports.isExternalLinkTargetSet = exports.addLinkAttributes = exports.RenderingCancelledException = exports.CustomStyle = undefined;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
@ -3537,6 +3514,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de @@ -3537,6 +3514,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var DEFAULT_LINK_REL = 'noopener noreferrer nofollow';
var SVG_NS = 'http://www.w3.org/2000/svg';
var DOMCanvasFactory = function () {
function DOMCanvasFactory() {
@ -3645,6 +3623,34 @@ var DOMCMapReaderFactory = function () { @@ -3645,6 +3623,34 @@ var DOMCMapReaderFactory = function () {
return DOMCMapReaderFactory;
}();
var DOMSVGFactory = function () {
function DOMSVGFactory() {
_classCallCheck(this, DOMSVGFactory);
}
_createClass(DOMSVGFactory, [{
key: 'create',
value: function create(width, height) {
(0, _util.assert)(width > 0 && height > 0, 'Invalid SVG dimensions');
var svg = document.createElementNS(SVG_NS, 'svg:svg');
svg.setAttribute('version', '1.1');
svg.setAttribute('width', width + 'px');
svg.setAttribute('height', height + 'px');
svg.setAttribute('preserveAspectRatio', 'none');
svg.setAttribute('viewBox', '0 0 ' + width + ' ' + height);
return svg;
}
}, {
key: 'createElement',
value: function createElement(type) {
(0, _util.assert)(typeof type === 'string', 'Invalid SVG element type');
return document.createElementNS(SVG_NS, type);
}
}]);
return DOMSVGFactory;
}();
var CustomStyle = function CustomStyleClosure() {
var prefixes = ['ms', 'Moz', 'Webkit', 'O'];
var _cache = Object.create(null);
@ -3805,6 +3811,30 @@ exports.getDefaultSetting = getDefaultSetting; @@ -3805,6 +3811,30 @@ exports.getDefaultSetting = getDefaultSetting;
exports.DEFAULT_LINK_REL = DEFAULT_LINK_REL;
exports.DOMCanvasFactory = DOMCanvasFactory;
exports.DOMCMapReaderFactory = DOMCMapReaderFactory;
exports.DOMSVGFactory = DOMSVGFactory;
/***/ }),
/* 10 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
var anObject = __w_pdfjs_require__(21);
var IE8_DOM_DEFINE = __w_pdfjs_require__(38);
var toPrimitive = __w_pdfjs_require__(27);
var dP = Object.defineProperty;
exports.f = __w_pdfjs_require__(5) ? Object.defineProperty : function defineProperty(O, P, Attributes) {
anObject(O);
P = toPrimitive(P, true);
anObject(Attributes);
if (IE8_DOM_DEFINE) try {
return dP(O, P, Attributes);
} catch (e) {}
if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
if ('value' in Attributes) O[P] = Attributes.value;
return O;
};
/***/ }),
/* 11 */
@ -6030,7 +6060,7 @@ module.exports = 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable, @@ -6030,7 +6060,7 @@ module.exports = 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,
"use strict";
var def = __w_pdfjs_require__(9).f;
var def = __w_pdfjs_require__(10).f;
var has = __w_pdfjs_require__(7);
var TAG = __w_pdfjs_require__(2)('toStringTag');
module.exports = function (it, tag, stat) {
@ -11999,7 +12029,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol @@ -11999,7 +12029,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
var _util = __w_pdfjs_require__(0);
var _dom_utils = __w_pdfjs_require__(10);
var _dom_utils = __w_pdfjs_require__(9);
var _font_loader = __w_pdfjs_require__(99);
@ -13443,8 +13473,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() { @@ -13443,8 +13473,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
}();
var version, build;
{
exports.version = version = '1.9.544';
exports.build = build = '437e9cb0';
exports.version = version = '1.9.549';
exports.build = build = '320779e6';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;
@ -13469,7 +13499,7 @@ Object.defineProperty(exports, "__esModule", { @@ -13469,7 +13499,7 @@ Object.defineProperty(exports, "__esModule", {
});
exports.WebGLUtils = undefined;
var _dom_utils = __w_pdfjs_require__(10);
var _dom_utils = __w_pdfjs_require__(9);
var _util = __w_pdfjs_require__(0);
@ -26804,7 +26834,7 @@ exports.AnnotationLayer = undefined; @@ -26804,7 +26834,7 @@ exports.AnnotationLayer = undefined;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _dom_utils = __w_pdfjs_require__(10);
var _dom_utils = __w_pdfjs_require__(9);
var _util = __w_pdfjs_require__(0);
@ -26849,6 +26879,10 @@ var AnnotationElementFactory = function () { @@ -26849,6 +26879,10 @@ var AnnotationElementFactory = function () {
return new PopupAnnotationElement(parameters);
case _util.AnnotationType.LINE:
return new LineAnnotationElement(parameters);
case _util.AnnotationType.SQUARE:
return new SquareAnnotationElement(parameters);
case _util.AnnotationType.CIRCLE:
return new CircleAnnotationElement(parameters);
case _util.AnnotationType.HIGHLIGHT:
return new HighlightAnnotationElement(parameters);
case _util.AnnotationType.UNDERLINE:
@ -26884,6 +26918,7 @@ var AnnotationElement = function () { @@ -26884,6 +26918,7 @@ var AnnotationElement = function () {
this.downloadManager = parameters.downloadManager;
this.imageResourcesPath = parameters.imageResourcesPath;
this.renderInteractiveForms = parameters.renderInteractiveForms;
this.svgFactory = parameters.svgFactory;
if (isRenderable) {
this.container = this._createContainer(ignoreBorder);
}
@ -27270,7 +27305,7 @@ var PopupAnnotationElement = function (_AnnotationElement4) { @@ -27270,7 +27305,7 @@ var PopupAnnotationElement = function (_AnnotationElement4) {
_createClass(PopupAnnotationElement, [{
key: 'render',
value: function render() {
var IGNORE_TYPES = ['Line'];
var IGNORE_TYPES = ['Line', 'Square', 'Circle'];
this.container.className = 'popupAnnotation';
if (IGNORE_TYPES.indexOf(this.data.parentType) >= 0) {
return this.container;
@ -27408,27 +27443,21 @@ var LineAnnotationElement = function (_AnnotationElement5) { @@ -27408,27 +27443,21 @@ var LineAnnotationElement = function (_AnnotationElement5) {
_createClass(LineAnnotationElement, [{
key: 'render',
value: function render() {
var SVG_NS = 'http://www.w3.org/2000/svg';
this.container.className = 'lineAnnotation';
var data = this.data;
var width = data.rect[2] - data.rect[0];
var height = data.rect[3] - data.rect[1];
var svg = document.createElementNS(SVG_NS, 'svg:svg');
svg.setAttributeNS(null, 'version', '1.1');
svg.setAttributeNS(null, 'width', width + 'px');
svg.setAttributeNS(null, 'height', height + 'px');
svg.setAttributeNS(null, 'preserveAspectRatio', 'none');
svg.setAttributeNS(null, 'viewBox', '0 0 ' + width + ' ' + height);
var line = document.createElementNS(SVG_NS, 'svg:line');
line.setAttributeNS(null, 'x1', data.rect[2] - data.lineCoordinates[0]);
line.setAttributeNS(null, 'y1', data.rect[3] - data.lineCoordinates[1]);
line.setAttributeNS(null, 'x2', data.rect[2] - data.lineCoordinates[2]);
line.setAttributeNS(null, 'y2', data.rect[3] - data.lineCoordinates[3]);
line.setAttributeNS(null, 'stroke-width', data.borderStyle.width);
line.setAttributeNS(null, 'stroke', 'transparent');
var svg = this.svgFactory.create(width, height);
var line = this.svgFactory.createElement('svg:line');
line.setAttribute('x1', data.rect[2] - data.lineCoordinates[0]);
line.setAttribute('y1', data.rect[3] - data.lineCoordinates[1]);
line.setAttribute('x2', data.rect[2] - data.lineCoordinates[2]);
line.setAttribute('y2', data.rect[3] - data.lineCoordinates[3]);
line.setAttribute('stroke-width', data.borderStyle.width);
line.setAttribute('stroke', 'transparent');
svg.appendChild(line);
this.container.append(svg);
this._createPopup(this.container, line, this.data);
this._createPopup(this.container, line, data);
return this.container;
}
}]);
@ -27436,8 +27465,82 @@ var LineAnnotationElement = function (_AnnotationElement5) { @@ -27436,8 +27465,82 @@ var LineAnnotationElement = function (_AnnotationElement5) {
return LineAnnotationElement;
}(AnnotationElement);
var HighlightAnnotationElement = function (_AnnotationElement6) {
_inherits(HighlightAnnotationElement, _AnnotationElement6);
var SquareAnnotationElement = function (_AnnotationElement6) {
_inherits(SquareAnnotationElement, _AnnotationElement6);
function SquareAnnotationElement(parameters) {
_classCallCheck(this, SquareAnnotationElement);
var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
return _possibleConstructorReturn(this, (SquareAnnotationElement.__proto__ || Object.getPrototypeOf(SquareAnnotationElement)).call(this, parameters, isRenderable, true));
}
_createClass(SquareAnnotationElement, [{
key: 'render',
value: function render() {
this.container.className = 'squareAnnotation';
var data = this.data;
var width = data.rect[2] - data.rect[0];
var height = data.rect[3] - data.rect[1];
var svg = this.svgFactory.create(width, height);
var borderWidth = data.borderStyle.width;
var square = this.svgFactory.createElement('svg:rect');
square.setAttribute('x', borderWidth / 2);
square.setAttribute('y', borderWidth / 2);
square.setAttribute('width', width - borderWidth);
square.setAttribute('height', height - borderWidth);
square.setAttribute('stroke-width', borderWidth);
square.setAttribute('stroke', 'transparent');
square.setAttribute('fill', 'none');
svg.appendChild(square);
this.container.append(svg);
this._createPopup(this.container, square, data);
return this.container;
}
}]);
return SquareAnnotationElement;
}(AnnotationElement);
var CircleAnnotationElement = function (_AnnotationElement7) {
_inherits(CircleAnnotationElement, _AnnotationElement7);
function CircleAnnotationElement(parameters) {
_classCallCheck(this, CircleAnnotationElement);
var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
return _possibleConstructorReturn(this, (CircleAnnotationElement.__proto__ || Object.getPrototypeOf(CircleAnnotationElement)).call(this, parameters, isRenderable, true));
}
_createClass(CircleAnnotationElement, [{
key: 'render',
value: function render() {
this.container.className = 'circleAnnotation';
var data = this.data;
var width = data.rect[2] - data.rect[0];
var height = data.rect[3] - data.rect[1];
var svg = this.svgFactory.create(width, height);
var borderWidth = data.borderStyle.width;
var circle = this.svgFactory.createElement('svg:ellipse');
circle.setAttribute('cx', width / 2);
circle.setAttribute('cy', height / 2);
circle.setAttribute('rx', width / 2 - borderWidth / 2);
circle.setAttribute('ry', height / 2 - borderWidth / 2);
circle.setAttribute('stroke-width', borderWidth);
circle.setAttribute('stroke', 'transparent');
circle.setAttribute('fill', 'none');
svg.appendChild(circle);
this.container.append(svg);
this._createPopup(this.container, circle, data);
return this.container;
}
}]);
return CircleAnnotationElement;
}(AnnotationElement);
var HighlightAnnotationElement = function (_AnnotationElement8) {
_inherits(HighlightAnnotationElement, _AnnotationElement8);
function HighlightAnnotationElement(parameters) {
_classCallCheck(this, HighlightAnnotationElement);
@ -27460,8 +27563,8 @@ var HighlightAnnotationElement = function (_AnnotationElement6) { @@ -27460,8 +27563,8 @@ var HighlightAnnotationElement = function (_AnnotationElement6) {
return HighlightAnnotationElement;
}(AnnotationElement);
var UnderlineAnnotationElement = function (_AnnotationElement7) {
_inherits(UnderlineAnnotationElement, _AnnotationElement7);
var UnderlineAnnotationElement = function (_AnnotationElement9) {
_inherits(UnderlineAnnotationElement, _AnnotationElement9);
function UnderlineAnnotationElement(parameters) {
_classCallCheck(this, UnderlineAnnotationElement);
@ -27484,8 +27587,8 @@ var UnderlineAnnotationElement = function (_AnnotationElement7) { @@ -27484,8 +27587,8 @@ var UnderlineAnnotationElement = function (_AnnotationElement7) {
return UnderlineAnnotationElement;
}(AnnotationElement);
var SquigglyAnnotationElement = function (_AnnotationElement8) {
_inherits(SquigglyAnnotationElement, _AnnotationElement8);
var SquigglyAnnotationElement = function (_AnnotationElement10) {
_inherits(SquigglyAnnotationElement, _AnnotationElement10);
function SquigglyAnnotationElement(parameters) {
_classCallCheck(this, SquigglyAnnotationElement);
@ -27508,8 +27611,8 @@ var SquigglyAnnotationElement = function (_AnnotationElement8) { @@ -27508,8 +27611,8 @@ var SquigglyAnnotationElement = function (_AnnotationElement8) {
return SquigglyAnnotationElement;
}(AnnotationElement);
var StrikeOutAnnotationElement = function (_AnnotationElement9) {
_inherits(StrikeOutAnnotationElement, _AnnotationElement9);
var StrikeOutAnnotationElement = function (_AnnotationElement11) {
_inherits(StrikeOutAnnotationElement, _AnnotationElement11);
function StrikeOutAnnotationElement(parameters) {
_classCallCheck(this, StrikeOutAnnotationElement);
@ -27532,23 +27635,23 @@ var StrikeOutAnnotationElement = function (_AnnotationElement9) { @@ -27532,23 +27635,23 @@ var StrikeOutAnnotationElement = function (_AnnotationElement9) {
return StrikeOutAnnotationElement;
}(AnnotationElement);
var FileAttachmentAnnotationElement = function (_AnnotationElement10) {
_inherits(FileAttachmentAnnotationElement, _AnnotationElement10);
var FileAttachmentAnnotationElement = function (_AnnotationElement12) {
_inherits(FileAttachmentAnnotationElement, _AnnotationElement12);
function FileAttachmentAnnotationElement(parameters) {
_classCallCheck(this, FileAttachmentAnnotationElement);
var _this16 = _possibleConstructorReturn(this, (FileAttachmentAnnotationElement.__proto__ || Object.getPrototypeOf(FileAttachmentAnnotationElement)).call(this, parameters, true));
var _this18 = _possibleConstructorReturn(this, (FileAttachmentAnnotationElement.__proto__ || Object.getPrototypeOf(FileAttachmentAnnotationElement)).call(this, parameters, true));
var file = _this16.data.file;
_this16.filename = (0, _dom_utils.getFilenameFromUrl)(file.filename);
_this16.content = file.content;
_this16.linkService.onFileAttachmentAnnotation({
var file = _this18.data.file;
_this18.filename = (0, _dom_utils.getFilenameFromUrl)(file.filename);
_this18.content = file.content;
_this18.linkService.onFileAttachmentAnnotation({
id: (0, _util.stringToPDFString)(file.filename),
filename: file.filename,
content: file.content
});
return _this16;
return _this18;
}
_createClass(FileAttachmentAnnotationElement, [{
@ -27600,7 +27703,8 @@ var AnnotationLayer = function () { @@ -27600,7 +27703,8 @@ var AnnotationLayer = function () {
linkService: parameters.linkService,
downloadManager: parameters.downloadManager,
imageResourcesPath: parameters.imageResourcesPath || (0, _dom_utils.getDefaultSetting)('imageResourcesPath'),
renderInteractiveForms: parameters.renderInteractiveForms || false
renderInteractiveForms: parameters.renderInteractiveForms || false,
svgFactory: new _dom_utils.DOMSVGFactory()
});
if (element.isRenderable) {
parameters.div.appendChild(element.render());
@ -27640,7 +27744,7 @@ exports.renderTextLayer = undefined; @@ -27640,7 +27744,7 @@ exports.renderTextLayer = undefined;
var _util = __w_pdfjs_require__(0);
var _dom_utils = __w_pdfjs_require__(10);
var _dom_utils = __w_pdfjs_require__(9);
var renderTextLayer = function renderTextLayerClosure() {
var MAX_TEXT_DIVS_TO_RENDER = 100000;
@ -28191,6 +28295,8 @@ exports.SVGGraphics = undefined; @@ -28191,6 +28295,8 @@ exports.SVGGraphics = undefined;
var _util = __w_pdfjs_require__(0);
var _dom_utils = __w_pdfjs_require__(9);
var SVGGraphics = function SVGGraphics() {
throw new Error('Not implemented: SVGGraphics');
};
@ -28468,6 +28574,7 @@ var SVGGraphics = function SVGGraphics() { @@ -28468,6 +28574,7 @@ var SVGGraphics = function SVGGraphics() {
return 'matrix(' + pf(m[0]) + ' ' + pf(m[1]) + ' ' + pf(m[2]) + ' ' + pf(m[3]) + ' ' + pf(m[4]) + ' ' + pf(m[5]) + ')';
}
function SVGGraphics(commonObjs, objs, forceDataSchema) {
this.svgFactory = new _dom_utils.DOMSVGFactory();
this.current = new SVGExtraState();
this.transformMatrix = _util.IDENTITY_MATRIX;
this.transformStack = [];
@ -28481,7 +28588,6 @@ var SVGGraphics = function SVGGraphics() { @@ -28481,7 +28588,6 @@ var SVGGraphics = function SVGGraphics() {
this.cssStyle = null;
this.forceDataSchema = !!forceDataSchema;
}
var NS = 'http://www.w3.org/2000/svg';
var XML_NS = 'http://www.w3.org/XML/1998/namespace';
var XLINK_NS = 'http://www.w3.org/1999/xlink';
var LINE_CAP_STYLES = ['butt', 'round', 'square'];
@ -28727,11 +28833,11 @@ var SVGGraphics = function SVGGraphics() { @@ -28727,11 +28833,11 @@ var SVGGraphics = function SVGGraphics() {
this.current.x = this.current.lineX = 0;
this.current.y = this.current.lineY = 0;
current.xcoords = [];
current.tspan = document.createElementNS(NS, 'svg:tspan');
current.tspan = this.svgFactory.createElement('svg:tspan');
current.tspan.setAttributeNS(null, 'font-family', current.fontFamily);
current.tspan.setAttributeNS(null, 'font-size', pf(current.fontSize) + 'px');
current.tspan.setAttributeNS(null, 'y', pf(-current.y));
current.txtElement = document.createElementNS(NS, 'svg:text');
current.txtElement = this.svgFactory.createElement('svg:text');
current.txtElement.appendChild(current.tspan);
},
beginText: function SVGGraphics_beginText() {
@ -28739,9 +28845,9 @@ var SVGGraphics = function SVGGraphics() { @@ -28739,9 +28845,9 @@ var SVGGraphics = function SVGGraphics() {
this.current.y = this.current.lineY = 0;
this.current.textMatrix = _util.IDENTITY_MATRIX;
this.current.lineMatrix = _util.IDENTITY_MATRIX;
this.current.tspan = document.createElementNS(NS, 'svg:tspan');
this.current.txtElement = document.createElementNS(NS, 'svg:text');
this.current.txtgrp = document.createElementNS(NS, 'svg:g');
this.current.tspan = this.svgFactory.createElement('svg:tspan');
this.current.txtElement = this.svgFactory.createElement('svg:text');
this.current.txtgrp = this.svgFactory.createElement('svg:g');
this.current.xcoords = [];
},
moveText: function SVGGraphics_moveText(x, y) {
@ -28749,7 +28855,7 @@ var SVGGraphics = function SVGGraphics() { @@ -28749,7 +28855,7 @@ var SVGGraphics = function SVGGraphics() {
this.current.x = this.current.lineX += x;
this.current.y = this.current.lineY += y;
current.xcoords = [];
current.tspan = document.createElementNS(NS, 'svg:tspan');
current.tspan = this.svgFactory.createElement('svg:tspan');
current.tspan.setAttributeNS(null, 'font-family', current.fontFamily);
current.tspan.setAttributeNS(null, 'font-size', pf(current.fontSize) + 'px');
current.tspan.setAttributeNS(null, 'y', pf(-current.y));
@ -28826,7 +28932,7 @@ var SVGGraphics = function SVGGraphics() { @@ -28826,7 +28932,7 @@ var SVGGraphics = function SVGGraphics() {
},
addFontStyle: function SVGGraphics_addFontStyle(fontObj) {
if (!this.cssStyle) {
this.cssStyle = document.createElementNS(NS, 'svg:style');
this.cssStyle = this.svgFactory.createElement('svg:style');
this.cssStyle.setAttributeNS(null, 'type', 'text/css');
this.defs.appendChild(this.cssStyle);
}
@ -28855,7 +28961,7 @@ var SVGGraphics = function SVGGraphics() { @@ -28855,7 +28961,7 @@ var SVGGraphics = function SVGGraphics() {
current.fontFamily = fontObj.loadedName;
current.fontWeight = bold;
current.fontStyle = italic;
current.tspan = document.createElementNS(NS, 'svg:tspan');
current.tspan = this.svgFactory.createElement('svg:tspan');
current.tspan.setAttributeNS(null, 'y', pf(-current.y));
current.xcoords = [];
},
@ -28885,7 +28991,7 @@ var SVGGraphics = function SVGGraphics() { @@ -28885,7 +28991,7 @@ var SVGGraphics = function SVGGraphics() {
setFillRGBColor: function SVGGraphics_setFillRGBColor(r, g, b) {
var color = _util.Util.makeCssRgb(r, g, b);
this.current.fillColor = color;
this.current.tspan = document.createElementNS(NS, 'svg:tspan');
this.current.tspan = this.svgFactory.createElement('svg:tspan');
this.current.xcoords = [];
},
setDash: function SVGGraphics_setDash(dashArray, dashPhase) {
@ -28896,7 +29002,7 @@ var SVGGraphics = function SVGGraphics() { @@ -28896,7 +29002,7 @@ var SVGGraphics = function SVGGraphics() {
var current = this.current;
var x = current.x,
y = current.y;
current.path = document.createElementNS(NS, 'svg:path');
current.path = this.svgFactory.createElement('svg:path');
var d = [];
var opLength = ops.length;
for (var i = 0, j = 0; i < opLength; i++) {
@ -28956,7 +29062,7 @@ var SVGGraphics = function SVGGraphics() { @@ -28956,7 +29062,7 @@ var SVGGraphics = function SVGGraphics() {
var current = this.current;
var clipId = 'clippath' + clipCount;
clipCount++;
var clipPath = document.createElementNS(NS, 'svg:clipPath');
var clipPath = this.svgFactory.createElement('svg:clipPath');
clipPath.setAttributeNS(null, 'id', clipId);
clipPath.setAttributeNS(null, 'transform', pm(this.transformMatrix));
var clipElement = current.element.cloneNode();
@ -29070,7 +29176,7 @@ var SVGGraphics = function SVGGraphics() { @@ -29070,7 +29176,7 @@ var SVGGraphics = function SVGGraphics() {
},
paintSolidColorImageMask: function SVGGraphics_paintSolidColorImageMask() {
var current = this.current;
var rect = document.createElementNS(NS, 'svg:rect');
var rect = this.svgFactory.createElement('svg:rect');
rect.setAttributeNS(null, 'x', '0');
rect.setAttributeNS(null, 'y', '0');
rect.setAttributeNS(null, 'width', '1px');
@ -29080,7 +29186,7 @@ var SVGGraphics = function SVGGraphics() { @@ -29080,7 +29186,7 @@ var SVGGraphics = function SVGGraphics() {
},
paintJpegXObject: function SVGGraphics_paintJpegXObject(objId, w, h) {
var imgObj = this.objs.get(objId);
var imgEl = document.createElementNS(NS, 'svg:image');
var imgEl = this.svgFactory.createElement('svg:image');
imgEl.setAttributeNS(XLINK_NS, 'xlink:href', imgObj.src);
imgEl.setAttributeNS(null, 'width', pf(w));
imgEl.setAttributeNS(null, 'height', pf(h));
@ -29101,14 +29207,14 @@ var SVGGraphics = function SVGGraphics() { @@ -29101,14 +29207,14 @@ var SVGGraphics = function SVGGraphics() {
var width = imgData.width;
var height = imgData.height;
var imgSrc = convertImgDataToPng(imgData, this.forceDataSchema);
var cliprect = document.createElementNS(NS, 'svg:rect');
var cliprect = this.svgFactory.createElement('svg:rect');
cliprect.setAttributeNS(null, 'x', '0');
cliprect.setAttributeNS(null, 'y', '0');
cliprect.setAttributeNS(null, 'width', pf(width));
cliprect.setAttributeNS(null, 'height', pf(height));
this.current.element = cliprect;
this.clip('nonzero');
var imgEl = document.createElementNS(NS, 'svg:image');
var imgEl = this.svgFactory.createElement('svg:image');
imgEl.setAttributeNS(XLINK_NS, 'xlink:href', imgSrc);
imgEl.setAttributeNS(null, 'x', '0');
imgEl.setAttributeNS(null, 'y', pf(-height));
@ -29127,9 +29233,9 @@ var SVGGraphics = function SVGGraphics() { @@ -29127,9 +29233,9 @@ var SVGGraphics = function SVGGraphics() {
var height = imgData.height;
var fillColor = current.fillColor;
current.maskId = 'mask' + maskCount++;
var mask = document.createElementNS(NS, 'svg:mask');
var mask = this.svgFactory.createElement('svg:mask');
mask.setAttributeNS(null, 'id', current.maskId);
var rect = document.createElementNS(NS, 'svg:rect');
var rect = this.svgFactory.createElement('svg:rect');
rect.setAttributeNS(null, 'x', '0');
rect.setAttributeNS(null, 'y', '0');
rect.setAttributeNS(null, 'width', pf(width));
@ -29147,7 +29253,7 @@ var SVGGraphics = function SVGGraphics() { @@ -29147,7 +29253,7 @@ var SVGGraphics = function SVGGraphics() {
if (Array.isArray(bbox) && bbox.length === 4) {
var width = bbox[2] - bbox[0];
var height = bbox[3] - bbox[1];
var cliprect = document.createElementNS(NS, 'svg:rect');
var cliprect = this.svgFactory.createElement('svg:rect');
cliprect.setAttributeNS(null, 'x', bbox[0]);
cliprect.setAttributeNS(null, 'y', bbox[1]);
cliprect.setAttributeNS(null, 'width', pf(width));
@ -29158,25 +29264,21 @@ var SVGGraphics = function SVGGraphics() { @@ -29158,25 +29264,21 @@ var SVGGraphics = function SVGGraphics() {
}
},
paintFormXObjectEnd: function SVGGraphics_paintFormXObjectEnd() {},
_initialize: function SVGGraphics_initialize(viewport) {
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, 'preserveAspectRatio', 'none');
svg.setAttributeNS(null, 'viewBox', '0 0 ' + viewport.width + ' ' + viewport.height);
var definitions = document.createElementNS(NS, 'svg:defs');
_initialize: function _initialize(viewport) {
var svg = this.svgFactory.create(viewport.width, viewport.height);
var definitions = this.svgFactory.createElement('svg:defs');
svg.appendChild(definitions);
this.defs = definitions;
var rootGroup = document.createElementNS(NS, 'svg:g');
var rootGroup = this.svgFactory.createElement('svg:g');
rootGroup.setAttributeNS(null, 'transform', pm(viewport.transform));
svg.appendChild(rootGroup);
this.svg = rootGroup;
return svg;
},
_ensureClipGroup: function SVGGraphics_ensureClipGroup() {
if (!this.current.clipGroup) {
var clipGroup = document.createElementNS(NS, 'svg:g');
var clipGroup = this.svgFactory.createElement('svg:g');
clipGroup.setAttributeNS(null, 'clip-path', this.current.activeClipUrl);
this.svg.appendChild(clipGroup);
this.current.clipGroup = clipGroup;
@ -29185,7 +29287,7 @@ var SVGGraphics = function SVGGraphics() { @@ -29185,7 +29287,7 @@ var SVGGraphics = function SVGGraphics() {
},
_ensureTransformGroup: function SVGGraphics_ensureTransformGroup() {
if (!this.tgrp) {
this.tgrp = document.createElementNS(NS, 'svg:g');
this.tgrp = this.svgFactory.createElement('svg:g');
this.tgrp.setAttributeNS(null, 'transform', pm(this.transformMatrix));
if (this.current.activeClipUrl) {
this._ensureClipGroup().appendChild(this.tgrp);
@ -29208,14 +29310,14 @@ exports.SVGGraphics = SVGGraphics; @@ -29208,14 +29310,14 @@ exports.SVGGraphics = SVGGraphics;
"use strict";
var pdfjsVersion = '1.9.544';
var pdfjsBuild = '437e9cb0';
var pdfjsVersion = '1.9.549';
var pdfjsBuild = '320779e6';
var pdfjsSharedUtil = __w_pdfjs_require__(0);
var pdfjsDisplayGlobal = __w_pdfjs_require__(98);
var pdfjsDisplayAPI = __w_pdfjs_require__(55);
var pdfjsDisplayTextLayer = __w_pdfjs_require__(68);
var pdfjsDisplayAnnotationLayer = __w_pdfjs_require__(67);
var pdfjsDisplayDOMUtils = __w_pdfjs_require__(10);
var pdfjsDisplayDOMUtils = __w_pdfjs_require__(9);
var pdfjsDisplaySVG = __w_pdfjs_require__(69);
{
if (pdfjsSharedUtil.isNodeJS()) {
@ -30850,7 +30952,7 @@ if (__w_pdfjs_require__(5)) { @@ -30850,7 +30952,7 @@ if (__w_pdfjs_require__(5)) {
var setSpecies = __w_pdfjs_require__(92);
var arrayFill = __w_pdfjs_require__(51);
var arrayCopyWithin = __w_pdfjs_require__(93);
var $DP = __w_pdfjs_require__(9);
var $DP = __w_pdfjs_require__(10);
var $GOPD = __w_pdfjs_require__(94);
var dP = $DP.f;
var gOPD = $GOPD.f;
@ -31267,7 +31369,7 @@ var toInteger = __w_pdfjs_require__(14); @@ -31267,7 +31369,7 @@ var toInteger = __w_pdfjs_require__(14);
var toLength = __w_pdfjs_require__(8);
var toIndex = __w_pdfjs_require__(44);
var gOPN = __w_pdfjs_require__(45).f;
var dP = __w_pdfjs_require__(9).f;
var dP = __w_pdfjs_require__(10).f;
var arrayFill = __w_pdfjs_require__(51);
var setToStringTag = __w_pdfjs_require__(33);
var ARRAY_BUFFER = 'ArrayBuffer';
@ -31546,7 +31648,7 @@ module.exports = function (it) { @@ -31546,7 +31648,7 @@ module.exports = function (it) {
"use strict";
var dP = __w_pdfjs_require__(9);
var dP = __w_pdfjs_require__(10);
var anObject = __w_pdfjs_require__(21);
var getKeys = __w_pdfjs_require__(78);
module.exports = __w_pdfjs_require__(5) ? Object.defineProperties : function defineProperties(O, Properties) {
@ -31913,7 +32015,7 @@ module.exports = function (exec, skipClosing) { @@ -31913,7 +32015,7 @@ module.exports = function (exec, skipClosing) {
var global = __w_pdfjs_require__(4);
var dP = __w_pdfjs_require__(9);
var dP = __w_pdfjs_require__(10);
var DESCRIPTORS = __w_pdfjs_require__(5);
var SPECIES = __w_pdfjs_require__(2)('species');
module.exports = function (KEY) {
@ -35047,7 +35149,7 @@ exports.PDFJS = exports.isWorker = exports.globalScope = undefined; @@ -35047,7 +35149,7 @@ exports.PDFJS = exports.isWorker = exports.globalScope = undefined;
var _api = __w_pdfjs_require__(55);
var _dom_utils = __w_pdfjs_require__(10);
var _dom_utils = __w_pdfjs_require__(9);
var _util = __w_pdfjs_require__(0);
@ -35071,8 +35173,8 @@ if (!_global_scope2.default.PDFJS) { @@ -35071,8 +35173,8 @@ if (!_global_scope2.default.PDFJS) {
}
var PDFJS = _global_scope2.default.PDFJS;
{
PDFJS.version = '1.9.544';
PDFJS.build = '437e9cb0';
PDFJS.version = '1.9.549';
PDFJS.build = '320779e6';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {
@ -50656,6 +50758,10 @@ var AnnotationFactory = function () { @@ -50656,6 +50758,10 @@ var AnnotationFactory = function () {
return new PopupAnnotation(parameters);
case 'Line':
return new LineAnnotation(parameters);
case 'Square':
return new SquareAnnotation(parameters);
case 'Circle':
return new CircleAnnotation(parameters);
case 'Highlight':
return new HighlightAnnotation(parameters);
case 'Underline':
@ -51292,83 +51398,115 @@ var LineAnnotation = function (_Annotation5) { @@ -51292,83 +51398,115 @@ var LineAnnotation = function (_Annotation5) {
return LineAnnotation;
}(Annotation);
var HighlightAnnotation = function (_Annotation6) {
_inherits(HighlightAnnotation, _Annotation6);
var SquareAnnotation = function (_Annotation6) {
_inherits(SquareAnnotation, _Annotation6);
function HighlightAnnotation(parameters) {
_classCallCheck(this, HighlightAnnotation);
function SquareAnnotation(parameters) {
_classCallCheck(this, SquareAnnotation);
var _this10 = _possibleConstructorReturn(this, (HighlightAnnotation.__proto__ || Object.getPrototypeOf(HighlightAnnotation)).call(this, parameters));
var _this10 = _possibleConstructorReturn(this, (SquareAnnotation.__proto__ || Object.getPrototypeOf(SquareAnnotation)).call(this, parameters));
_this10.data.annotationType = _util.AnnotationType.HIGHLIGHT;
_this10.data.annotationType = _util.AnnotationType.SQUARE;
_this10._preparePopup(parameters.dict);
return _this10;
}
return SquareAnnotation;
}(Annotation);
var CircleAnnotation = function (_Annotation7) {
_inherits(CircleAnnotation, _Annotation7);
function CircleAnnotation(parameters) {
_classCallCheck(this, CircleAnnotation);
var _this11 = _possibleConstructorReturn(this, (CircleAnnotation.__proto__ || Object.getPrototypeOf(CircleAnnotation)).call(this, parameters));
_this11.data.annotationType = _util.AnnotationType.CIRCLE;
_this11._preparePopup(parameters.dict);
return _this11;
}
return CircleAnnotation;
}(Annotation);
var HighlightAnnotation = function (_Annotation8) {
_inherits(HighlightAnnotation, _Annotation8);
function HighlightAnnotation(parameters) {
_classCallCheck(this, HighlightAnnotation);
var _this12 = _possibleConstructorReturn(this, (HighlightAnnotation.__proto__ || Object.getPrototypeOf(HighlightAnnotation)).call(this, parameters));
_this12.data.annotationType = _util.AnnotationType.HIGHLIGHT;
_this12._preparePopup(parameters.dict);
return _this12;
}
return HighlightAnnotation;
}(Annotation);
var UnderlineAnnotation = function (_Annotation7) {
_inherits(UnderlineAnnotation, _Annotation7);
var UnderlineAnnotation = function (_Annotation9) {
_inherits(UnderlineAnnotation, _Annotation9);
function UnderlineAnnotation(parameters) {
_classCallCheck(this, UnderlineAnnotation);
var _this11 = _possibleConstructorReturn(this, (UnderlineAnnotation.__proto__ || Object.getPrototypeOf(UnderlineAnnotation)).call(this, parameters));
var _this13 = _possibleConstructorReturn(this, (UnderlineAnnotation.__proto__ || Object.getPrototypeOf(UnderlineAnnotation)).call(this, parameters));
_this11.data.annotationType = _util.AnnotationType.UNDERLINE;
_this11._preparePopup(parameters.dict);
return _this11;
_this13.data.annotationType = _util.AnnotationType.UNDERLINE;
_this13._preparePopup(parameters.dict);
return _this13;
}
return UnderlineAnnotation;
}(Annotation);
var SquigglyAnnotation = function (_Annotation8) {
_inherits(SquigglyAnnotation, _Annotation8);
var SquigglyAnnotation = function (_Annotation10) {
_inherits(SquigglyAnnotation, _Annotation10);
function SquigglyAnnotation(parameters) {
_classCallCheck(this, SquigglyAnnotation);
var _this12 = _possibleConstructorReturn(this, (SquigglyAnnotation.__proto__ || Object.getPrototypeOf(SquigglyAnnotation)).call(this, parameters));
var _this14 = _possibleConstructorReturn(this, (SquigglyAnnotation.__proto__ || Object.getPrototypeOf(SquigglyAnnotation)).call(this, parameters));
_this12.data.annotationType = _util.AnnotationType.SQUIGGLY;
_this12._preparePopup(parameters.dict);
return _this12;
_this14.data.annotationType = _util.AnnotationType.SQUIGGLY;
_this14._preparePopup(parameters.dict);
return _this14;
}
return SquigglyAnnotation;
}(Annotation);
var StrikeOutAnnotation = function (_Annotation9) {
_inherits(StrikeOutAnnotation, _Annotation9);
var StrikeOutAnnotation = function (_Annotation11) {
_inherits(StrikeOutAnnotation, _Annotation11);
function StrikeOutAnnotation(parameters) {
_classCallCheck(this, StrikeOutAnnotation);
var _this13 = _possibleConstructorReturn(this, (StrikeOutAnnotation.__proto__ || Object.getPrototypeOf(StrikeOutAnnotation)).call(this, parameters));
var _this15 = _possibleConstructorReturn(this, (StrikeOutAnnotation.__proto__ || Object.getPrototypeOf(StrikeOutAnnotation)).call(this, parameters));
_this13.data.annotationType = _util.AnnotationType.STRIKEOUT;
_this13._preparePopup(parameters.dict);
return _this13;
_this15.data.annotationType = _util.AnnotationType.STRIKEOUT;
_this15._preparePopup(parameters.dict);
return _this15;
}
return StrikeOutAnnotation;
}(Annotation);
var FileAttachmentAnnotation = function (_Annotation10) {
_inherits(FileAttachmentAnnotation, _Annotation10);
var FileAttachmentAnnotation = function (_Annotation12) {
_inherits(FileAttachmentAnnotation, _Annotation12);
function FileAttachmentAnnotation(parameters) {
_classCallCheck(this, FileAttachmentAnnotation);
var _this14 = _possibleConstructorReturn(this, (FileAttachmentAnnotation.__proto__ || Object.getPrototypeOf(FileAttachmentAnnotation)).call(this, parameters));
var _this16 = _possibleConstructorReturn(this, (FileAttachmentAnnotation.__proto__ || Object.getPrototypeOf(FileAttachmentAnnotation)).call(this, parameters));
var file = new _obj.FileSpec(parameters.dict.get('FS'), parameters.xref);
_this14.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
_this14.data.file = file.serializable;
_this14._preparePopup(parameters.dict);
return _this14;
_this16.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
_this16.data.file = file.serializable;
_this16._preparePopup(parameters.dict);
return _this16;
}
return FileAttachmentAnnotation;

2
build/pdf.combined.js.map

File diff suppressed because one or more lines are too long

312
build/pdf.js

@ -1525,7 +1525,7 @@ module.exports = !__w_pdfjs_require__(15)(function () { @@ -1525,7 +1525,7 @@ module.exports = !__w_pdfjs_require__(15)(function () {
"use strict";
var dP = __w_pdfjs_require__(7);
var dP = __w_pdfjs_require__(8);
var createDesc = __w_pdfjs_require__(18);
module.exports = __w_pdfjs_require__(3) ? function (object, key, value) {
return dP.f(object, key, createDesc(1, value));
@ -1566,33 +1566,10 @@ module.exports = function (it) { @@ -1566,33 +1566,10 @@ module.exports = function (it) {
"use strict";
var anObject = __w_pdfjs_require__(17);
var IE8_DOM_DEFINE = __w_pdfjs_require__(31);
var toPrimitive = __w_pdfjs_require__(22);
var dP = Object.defineProperty;
exports.f = __w_pdfjs_require__(3) ? Object.defineProperty : function defineProperty(O, P, Attributes) {
anObject(O);
P = toPrimitive(P, true);
anObject(Attributes);
if (IE8_DOM_DEFINE) try {
return dP(O, P, Attributes);
} catch (e) {}
if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
if ('value' in Attributes) O[P] = Attributes.value;
return O;
};
/***/ }),
/* 8 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.DOMCMapReaderFactory = exports.DOMCanvasFactory = exports.DEFAULT_LINK_REL = exports.getDefaultSetting = exports.LinkTarget = exports.getFilenameFromUrl = exports.isValidUrl = exports.isExternalLinkTargetSet = exports.addLinkAttributes = exports.RenderingCancelledException = exports.CustomStyle = undefined;
exports.DOMSVGFactory = exports.DOMCMapReaderFactory = exports.DOMCanvasFactory = exports.DEFAULT_LINK_REL = exports.getDefaultSetting = exports.LinkTarget = exports.getFilenameFromUrl = exports.isValidUrl = exports.isExternalLinkTargetSet = exports.addLinkAttributes = exports.RenderingCancelledException = exports.CustomStyle = undefined;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
@ -1607,6 +1584,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de @@ -1607,6 +1584,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var DEFAULT_LINK_REL = 'noopener noreferrer nofollow';
var SVG_NS = 'http://www.w3.org/2000/svg';
var DOMCanvasFactory = function () {
function DOMCanvasFactory() {
@ -1715,6 +1693,34 @@ var DOMCMapReaderFactory = function () { @@ -1715,6 +1693,34 @@ var DOMCMapReaderFactory = function () {
return DOMCMapReaderFactory;
}();
var DOMSVGFactory = function () {
function DOMSVGFactory() {
_classCallCheck(this, DOMSVGFactory);
}
_createClass(DOMSVGFactory, [{
key: 'create',
value: function create(width, height) {
(0, _util.assert)(width > 0 && height > 0, 'Invalid SVG dimensions');
var svg = document.createElementNS(SVG_NS, 'svg:svg');
svg.setAttribute('version', '1.1');
svg.setAttribute('width', width + 'px');
svg.setAttribute('height', height + 'px');
svg.setAttribute('preserveAspectRatio', 'none');
svg.setAttribute('viewBox', '0 0 ' + width + ' ' + height);
return svg;
}
}, {
key: 'createElement',
value: function createElement(type) {
(0, _util.assert)(typeof type === 'string', 'Invalid SVG element type');
return document.createElementNS(SVG_NS, type);
}
}]);
return DOMSVGFactory;
}();
var CustomStyle = function CustomStyleClosure() {
var prefixes = ['ms', 'Moz', 'Webkit', 'O'];
var _cache = Object.create(null);
@ -1875,6 +1881,30 @@ exports.getDefaultSetting = getDefaultSetting; @@ -1875,6 +1881,30 @@ exports.getDefaultSetting = getDefaultSetting;
exports.DEFAULT_LINK_REL = DEFAULT_LINK_REL;
exports.DOMCanvasFactory = DOMCanvasFactory;
exports.DOMCMapReaderFactory = DOMCMapReaderFactory;
exports.DOMSVGFactory = DOMSVGFactory;
/***/ }),
/* 8 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
var anObject = __w_pdfjs_require__(17);
var IE8_DOM_DEFINE = __w_pdfjs_require__(31);
var toPrimitive = __w_pdfjs_require__(22);
var dP = Object.defineProperty;
exports.f = __w_pdfjs_require__(3) ? Object.defineProperty : function defineProperty(O, P, Attributes) {
anObject(O);
P = toPrimitive(P, true);
anObject(Attributes);
if (IE8_DOM_DEFINE) try {
return dP(O, P, Attributes);
} catch (e) {}
if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
if ('value' in Attributes) O[P] = Attributes.value;
return O;
};
/***/ }),
/* 9 */
@ -2160,7 +2190,7 @@ module.exports = 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable, @@ -2160,7 +2190,7 @@ module.exports = 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,
"use strict";
var def = __w_pdfjs_require__(7).f;
var def = __w_pdfjs_require__(8).f;
var has = __w_pdfjs_require__(5);
var TAG = __w_pdfjs_require__(1)('toStringTag');
module.exports = function (it, tag, stat) {
@ -2617,7 +2647,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol @@ -2617,7 +2647,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
var _util = __w_pdfjs_require__(0);
var _dom_utils = __w_pdfjs_require__(8);
var _dom_utils = __w_pdfjs_require__(7);
var _font_loader = __w_pdfjs_require__(83);
@ -4173,8 +4203,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() { @@ -4173,8 +4203,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
}();
var version, build;
{
exports.version = version = '1.9.544';
exports.build = build = '437e9cb0';
exports.version = version = '1.9.549';
exports.build = build = '320779e6';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;
@ -4199,7 +4229,7 @@ Object.defineProperty(exports, "__esModule", { @@ -4199,7 +4229,7 @@ Object.defineProperty(exports, "__esModule", {
});
exports.WebGLUtils = undefined;
var _dom_utils = __w_pdfjs_require__(8);
var _dom_utils = __w_pdfjs_require__(7);
var _util = __w_pdfjs_require__(0);
@ -4648,7 +4678,7 @@ exports.AnnotationLayer = undefined; @@ -4648,7 +4678,7 @@ exports.AnnotationLayer = undefined;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _dom_utils = __w_pdfjs_require__(8);
var _dom_utils = __w_pdfjs_require__(7);
var _util = __w_pdfjs_require__(0);
@ -4693,6 +4723,10 @@ var AnnotationElementFactory = function () { @@ -4693,6 +4723,10 @@ var AnnotationElementFactory = function () {
return new PopupAnnotationElement(parameters);
case _util.AnnotationType.LINE:
return new LineAnnotationElement(parameters);
case _util.AnnotationType.SQUARE:
return new SquareAnnotationElement(parameters);
case _util.AnnotationType.CIRCLE:
return new CircleAnnotationElement(parameters);
case _util.AnnotationType.HIGHLIGHT:
return new HighlightAnnotationElement(parameters);
case _util.AnnotationType.UNDERLINE:
@ -4728,6 +4762,7 @@ var AnnotationElement = function () { @@ -4728,6 +4762,7 @@ var AnnotationElement = function () {
this.downloadManager = parameters.downloadManager;
this.imageResourcesPath = parameters.imageResourcesPath;
this.renderInteractiveForms = parameters.renderInteractiveForms;
this.svgFactory = parameters.svgFactory;
if (isRenderable) {
this.container = this._createContainer(ignoreBorder);
}
@ -5114,7 +5149,7 @@ var PopupAnnotationElement = function (_AnnotationElement4) { @@ -5114,7 +5149,7 @@ var PopupAnnotationElement = function (_AnnotationElement4) {
_createClass(PopupAnnotationElement, [{
key: 'render',
value: function render() {
var IGNORE_TYPES = ['Line'];
var IGNORE_TYPES = ['Line', 'Square', 'Circle'];
this.container.className = 'popupAnnotation';
if (IGNORE_TYPES.indexOf(this.data.parentType) >= 0) {
return this.container;
@ -5252,27 +5287,21 @@ var LineAnnotationElement = function (_AnnotationElement5) { @@ -5252,27 +5287,21 @@ var LineAnnotationElement = function (_AnnotationElement5) {
_createClass(LineAnnotationElement, [{
key: 'render',
value: function render() {
var SVG_NS = 'http://www.w3.org/2000/svg';
this.container.className = 'lineAnnotation';
var data = this.data;
var width = data.rect[2] - data.rect[0];
var height = data.rect[3] - data.rect[1];
var svg = document.createElementNS(SVG_NS, 'svg:svg');
svg.setAttributeNS(null, 'version', '1.1');
svg.setAttributeNS(null, 'width', width + 'px');
svg.setAttributeNS(null, 'height', height + 'px');
svg.setAttributeNS(null, 'preserveAspectRatio', 'none');
svg.setAttributeNS(null, 'viewBox', '0 0 ' + width + ' ' + height);
var line = document.createElementNS(SVG_NS, 'svg:line');
line.setAttributeNS(null, 'x1', data.rect[2] - data.lineCoordinates[0]);
line.setAttributeNS(null, 'y1', data.rect[3] - data.lineCoordinates[1]);
line.setAttributeNS(null, 'x2', data.rect[2] - data.lineCoordinates[2]);
line.setAttributeNS(null, 'y2', data.rect[3] - data.lineCoordinates[3]);
line.setAttributeNS(null, 'stroke-width', data.borderStyle.width);
line.setAttributeNS(null, 'stroke', 'transparent');
var svg = this.svgFactory.create(width, height);
var line = this.svgFactory.createElement('svg:line');
line.setAttribute('x1', data.rect[2] - data.lineCoordinates[0]);
line.setAttribute('y1', data.rect[3] - data.lineCoordinates[1]);
line.setAttribute('x2', data.rect[2] - data.lineCoordinates[2]);
line.setAttribute('y2', data.rect[3] - data.lineCoordinates[3]);
line.setAttribute('stroke-width', data.borderStyle.width);
line.setAttribute('stroke', 'transparent');
svg.appendChild(line);
this.container.append(svg);
this._createPopup(this.container, line, this.data);
this._createPopup(this.container, line, data);
return this.container;
}
}]);
@ -5280,8 +5309,82 @@ var LineAnnotationElement = function (_AnnotationElement5) { @@ -5280,8 +5309,82 @@ var LineAnnotationElement = function (_AnnotationElement5) {
return LineAnnotationElement;
}(AnnotationElement);
var HighlightAnnotationElement = function (_AnnotationElement6) {
_inherits(HighlightAnnotationElement, _AnnotationElement6);
var SquareAnnotationElement = function (_AnnotationElement6) {
_inherits(SquareAnnotationElement, _AnnotationElement6);
function SquareAnnotationElement(parameters) {
_classCallCheck(this, SquareAnnotationElement);
var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
return _possibleConstructorReturn(this, (SquareAnnotationElement.__proto__ || Object.getPrototypeOf(SquareAnnotationElement)).call(this, parameters, isRenderable, true));
}
_createClass(SquareAnnotationElement, [{
key: 'render',
value: function render() {
this.container.className = 'squareAnnotation';
var data = this.data;
var width = data.rect[2] - data.rect[0];
var height = data.rect[3] - data.rect[1];
var svg = this.svgFactory.create(width, height);
var borderWidth = data.borderStyle.width;
var square = this.svgFactory.createElement('svg:rect');
square.setAttribute('x', borderWidth / 2);
square.setAttribute('y', borderWidth / 2);
square.setAttribute('width', width - borderWidth);
square.setAttribute('height', height - borderWidth);
square.setAttribute('stroke-width', borderWidth);
square.setAttribute('stroke', 'transparent');
square.setAttribute('fill', 'none');
svg.appendChild(square);
this.container.append(svg);
this._createPopup(this.container, square, data);
return this.container;
}
}]);
return SquareAnnotationElement;
}(AnnotationElement);
var CircleAnnotationElement = function (_AnnotationElement7) {
_inherits(CircleAnnotationElement, _AnnotationElement7);
function CircleAnnotationElement(parameters) {
_classCallCheck(this, CircleAnnotationElement);
var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
return _possibleConstructorReturn(this, (CircleAnnotationElement.__proto__ || Object.getPrototypeOf(CircleAnnotationElement)).call(this, parameters, isRenderable, true));
}
_createClass(CircleAnnotationElement, [{
key: 'render',
value: function render() {
this.container.className = 'circleAnnotation';
var data = this.data;
var width = data.rect[2] - data.rect[0];
var height = data.rect[3] - data.rect[1];
var svg = this.svgFactory.create(width, height);
var borderWidth = data.borderStyle.width;
var circle = this.svgFactory.createElement('svg:ellipse');
circle.setAttribute('cx', width / 2);
circle.setAttribute('cy', height / 2);
circle.setAttribute('rx', width / 2 - borderWidth / 2);
circle.setAttribute('ry', height / 2 - borderWidth / 2);
circle.setAttribute('stroke-width', borderWidth);
circle.setAttribute('stroke', 'transparent');
circle.setAttribute('fill', 'none');
svg.appendChild(circle);
this.container.append(svg);
this._createPopup(this.container, circle, data);
return this.container;
}
}]);
return CircleAnnotationElement;
}(AnnotationElement);
var HighlightAnnotationElement = function (_AnnotationElement8) {
_inherits(HighlightAnnotationElement, _AnnotationElement8);
function HighlightAnnotationElement(parameters) {
_classCallCheck(this, HighlightAnnotationElement);
@ -5304,8 +5407,8 @@ var HighlightAnnotationElement = function (_AnnotationElement6) { @@ -5304,8 +5407,8 @@ var HighlightAnnotationElement = function (_AnnotationElement6) {
return HighlightAnnotationElement;
}(AnnotationElement);
var UnderlineAnnotationElement = function (_AnnotationElement7) {
_inherits(UnderlineAnnotationElement, _AnnotationElement7);
var UnderlineAnnotationElement = function (_AnnotationElement9) {
_inherits(UnderlineAnnotationElement, _AnnotationElement9);
function UnderlineAnnotationElement(parameters) {
_classCallCheck(this, UnderlineAnnotationElement);
@ -5328,8 +5431,8 @@ var UnderlineAnnotationElement = function (_AnnotationElement7) { @@ -5328,8 +5431,8 @@ var UnderlineAnnotationElement = function (_AnnotationElement7) {
return UnderlineAnnotationElement;
}(AnnotationElement);
var SquigglyAnnotationElement = function (_AnnotationElement8) {
_inherits(SquigglyAnnotationElement, _AnnotationElement8);
var SquigglyAnnotationElement = function (_AnnotationElement10) {
_inherits(SquigglyAnnotationElement, _AnnotationElement10);
function SquigglyAnnotationElement(parameters) {
_classCallCheck(this, SquigglyAnnotationElement);
@ -5352,8 +5455,8 @@ var SquigglyAnnotationElement = function (_AnnotationElement8) { @@ -5352,8 +5455,8 @@ var SquigglyAnnotationElement = function (_AnnotationElement8) {
return SquigglyAnnotationElement;
}(AnnotationElement);
var StrikeOutAnnotationElement = function (_AnnotationElement9) {
_inherits(StrikeOutAnnotationElement, _AnnotationElement9);
var StrikeOutAnnotationElement = function (_AnnotationElement11) {
_inherits(StrikeOutAnnotationElement, _AnnotationElement11);
function StrikeOutAnnotationElement(parameters) {
_classCallCheck(this, StrikeOutAnnotationElement);
@ -5376,23 +5479,23 @@ var StrikeOutAnnotationElement = function (_AnnotationElement9) { @@ -5376,23 +5479,23 @@ var StrikeOutAnnotationElement = function (_AnnotationElement9) {
return StrikeOutAnnotationElement;
}(AnnotationElement);
var FileAttachmentAnnotationElement = function (_AnnotationElement10) {
_inherits(FileAttachmentAnnotationElement, _AnnotationElement10);
var FileAttachmentAnnotationElement = function (_AnnotationElement12) {
_inherits(FileAttachmentAnnotationElement, _AnnotationElement12);
function FileAttachmentAnnotationElement(parameters) {
_classCallCheck(this, FileAttachmentAnnotationElement);
var _this16 = _possibleConstructorReturn(this, (FileAttachmentAnnotationElement.__proto__ || Object.getPrototypeOf(FileAttachmentAnnotationElement)).call(this, parameters, true));
var _this18 = _possibleConstructorReturn(this, (FileAttachmentAnnotationElement.__proto__ || Object.getPrototypeOf(FileAttachmentAnnotationElement)).call(this, parameters, true));
var file = _this16.data.file;
_this16.filename = (0, _dom_utils.getFilenameFromUrl)(file.filename);
_this16.content = file.content;
_this16.linkService.onFileAttachmentAnnotation({
var file = _this18.data.file;
_this18.filename = (0, _dom_utils.getFilenameFromUrl)(file.filename);
_this18.content = file.content;
_this18.linkService.onFileAttachmentAnnotation({
id: (0, _util.stringToPDFString)(file.filename),
filename: file.filename,
content: file.content
});
return _this16;
return _this18;
}
_createClass(FileAttachmentAnnotationElement, [{
@ -5444,7 +5547,8 @@ var AnnotationLayer = function () { @@ -5444,7 +5547,8 @@ var AnnotationLayer = function () {
linkService: parameters.linkService,
downloadManager: parameters.downloadManager,
imageResourcesPath: parameters.imageResourcesPath || (0, _dom_utils.getDefaultSetting)('imageResourcesPath'),
renderInteractiveForms: parameters.renderInteractiveForms || false
renderInteractiveForms: parameters.renderInteractiveForms || false,
svgFactory: new _dom_utils.DOMSVGFactory()
});
if (element.isRenderable) {
parameters.div.appendChild(element.render());
@ -5484,7 +5588,7 @@ exports.renderTextLayer = undefined; @@ -5484,7 +5588,7 @@ exports.renderTextLayer = undefined;
var _util = __w_pdfjs_require__(0);
var _dom_utils = __w_pdfjs_require__(8);
var _dom_utils = __w_pdfjs_require__(7);
var renderTextLayer = function renderTextLayerClosure() {
var MAX_TEXT_DIVS_TO_RENDER = 100000;
@ -6036,6 +6140,8 @@ exports.SVGGraphics = undefined; @@ -6036,6 +6140,8 @@ exports.SVGGraphics = undefined;
var _util = __w_pdfjs_require__(0);
var _dom_utils = __w_pdfjs_require__(7);
var SVGGraphics = function SVGGraphics() {
throw new Error('Not implemented: SVGGraphics');
};
@ -6313,6 +6419,7 @@ var SVGGraphics = function SVGGraphics() { @@ -6313,6 +6419,7 @@ var SVGGraphics = function SVGGraphics() {
return 'matrix(' + pf(m[0]) + ' ' + pf(m[1]) + ' ' + pf(m[2]) + ' ' + pf(m[3]) + ' ' + pf(m[4]) + ' ' + pf(m[5]) + ')';
}
function SVGGraphics(commonObjs, objs, forceDataSchema) {
this.svgFactory = new _dom_utils.DOMSVGFactory();
this.current = new SVGExtraState();
this.transformMatrix = _util.IDENTITY_MATRIX;
this.transformStack = [];
@ -6326,7 +6433,6 @@ var SVGGraphics = function SVGGraphics() { @@ -6326,7 +6433,6 @@ var SVGGraphics = function SVGGraphics() {
this.cssStyle = null;
this.forceDataSchema = !!forceDataSchema;
}
var NS = 'http://www.w3.org/2000/svg';
var XML_NS = 'http://www.w3.org/XML/1998/namespace';
var XLINK_NS = 'http://www.w3.org/1999/xlink';
var LINE_CAP_STYLES = ['butt', 'round', 'square'];
@ -6572,11 +6678,11 @@ var SVGGraphics = function SVGGraphics() { @@ -6572,11 +6678,11 @@ var SVGGraphics = function SVGGraphics() {
this.current.x = this.current.lineX = 0;
this.current.y = this.current.lineY = 0;
current.xcoords = [];
current.tspan = document.createElementNS(NS, 'svg:tspan');
current.tspan = this.svgFactory.createElement('svg:tspan');
current.tspan.setAttributeNS(null, 'font-family', current.fontFamily);
current.tspan.setAttributeNS(null, 'font-size', pf(current.fontSize) + 'px');
current.tspan.setAttributeNS(null, 'y', pf(-current.y));
current.txtElement = document.createElementNS(NS, 'svg:text');
current.txtElement = this.svgFactory.createElement('svg:text');
current.txtElement.appendChild(current.tspan);
},
beginText: function SVGGraphics_beginText() {
@ -6584,9 +6690,9 @@ var SVGGraphics = function SVGGraphics() { @@ -6584,9 +6690,9 @@ var SVGGraphics = function SVGGraphics() {
this.current.y = this.current.lineY = 0;
this.current.textMatrix = _util.IDENTITY_MATRIX;
this.current.lineMatrix = _util.IDENTITY_MATRIX;
this.current.tspan = document.createElementNS(NS, 'svg:tspan');
this.current.txtElement = document.createElementNS(NS, 'svg:text');
this.current.txtgrp = document.createElementNS(NS, 'svg:g');
this.current.tspan = this.svgFactory.createElement('svg:tspan');
this.current.txtElement = this.svgFactory.createElement('svg:text');
this.current.txtgrp = this.svgFactory.createElement('svg:g');
this.current.xcoords = [];
},
moveText: function SVGGraphics_moveText(x, y) {
@ -6594,7 +6700,7 @@ var SVGGraphics = function SVGGraphics() { @@ -6594,7 +6700,7 @@ var SVGGraphics = function SVGGraphics() {
this.current.x = this.current.lineX += x;
this.current.y = this.current.lineY += y;
current.xcoords = [];
current.tspan = document.createElementNS(NS, 'svg:tspan');
current.tspan = this.svgFactory.createElement('svg:tspan');
current.tspan.setAttributeNS(null, 'font-family', current.fontFamily);
current.tspan.setAttributeNS(null, 'font-size', pf(current.fontSize) + 'px');
current.tspan.setAttributeNS(null, 'y', pf(-current.y));
@ -6671,7 +6777,7 @@ var SVGGraphics = function SVGGraphics() { @@ -6671,7 +6777,7 @@ var SVGGraphics = function SVGGraphics() {
},
addFontStyle: function SVGGraphics_addFontStyle(fontObj) {
if (!this.cssStyle) {
this.cssStyle = document.createElementNS(NS, 'svg:style');
this.cssStyle = this.svgFactory.createElement('svg:style');
this.cssStyle.setAttributeNS(null, 'type', 'text/css');
this.defs.appendChild(this.cssStyle);
}
@ -6700,7 +6806,7 @@ var SVGGraphics = function SVGGraphics() { @@ -6700,7 +6806,7 @@ var SVGGraphics = function SVGGraphics() {
current.fontFamily = fontObj.loadedName;
current.fontWeight = bold;
current.fontStyle = italic;
current.tspan = document.createElementNS(NS, 'svg:tspan');
current.tspan = this.svgFactory.createElement('svg:tspan');
current.tspan.setAttributeNS(null, 'y', pf(-current.y));
current.xcoords = [];
},
@ -6730,7 +6836,7 @@ var SVGGraphics = function SVGGraphics() { @@ -6730,7 +6836,7 @@ var SVGGraphics = function SVGGraphics() {
setFillRGBColor: function SVGGraphics_setFillRGBColor(r, g, b) {
var color = _util.Util.makeCssRgb(r, g, b);
this.current.fillColor = color;
this.current.tspan = document.createElementNS(NS, 'svg:tspan');
this.current.tspan = this.svgFactory.createElement('svg:tspan');
this.current.xcoords = [];
},
setDash: function SVGGraphics_setDash(dashArray, dashPhase) {
@ -6741,7 +6847,7 @@ var SVGGraphics = function SVGGraphics() { @@ -6741,7 +6847,7 @@ var SVGGraphics = function SVGGraphics() {
var current = this.current;
var x = current.x,
y = current.y;
current.path = document.createElementNS(NS, 'svg:path');
current.path = this.svgFactory.createElement('svg:path');
var d = [];
var opLength = ops.length;
for (var i = 0, j = 0; i < opLength; i++) {
@ -6801,7 +6907,7 @@ var SVGGraphics = function SVGGraphics() { @@ -6801,7 +6907,7 @@ var SVGGraphics = function SVGGraphics() {
var current = this.current;
var clipId = 'clippath' + clipCount;
clipCount++;
var clipPath = document.createElementNS(NS, 'svg:clipPath');
var clipPath = this.svgFactory.createElement('svg:clipPath');
clipPath.setAttributeNS(null, 'id', clipId);
clipPath.setAttributeNS(null, 'transform', pm(this.transformMatrix));
var clipElement = current.element.cloneNode();
@ -6915,7 +7021,7 @@ var SVGGraphics = function SVGGraphics() { @@ -6915,7 +7021,7 @@ var SVGGraphics = function SVGGraphics() {
},
paintSolidColorImageMask: function SVGGraphics_paintSolidColorImageMask() {
var current = this.current;
var rect = document.createElementNS(NS, 'svg:rect');
var rect = this.svgFactory.createElement('svg:rect');
rect.setAttributeNS(null, 'x', '0');
rect.setAttributeNS(null, 'y', '0');
rect.setAttributeNS(null, 'width', '1px');
@ -6925,7 +7031,7 @@ var SVGGraphics = function SVGGraphics() { @@ -6925,7 +7031,7 @@ var SVGGraphics = function SVGGraphics() {
},
paintJpegXObject: function SVGGraphics_paintJpegXObject(objId, w, h) {
var imgObj = this.objs.get(objId);
var imgEl = document.createElementNS(NS, 'svg:image');
var imgEl = this.svgFactory.createElement('svg:image');
imgEl.setAttributeNS(XLINK_NS, 'xlink:href', imgObj.src);
imgEl.setAttributeNS(null, 'width', pf(w));
imgEl.setAttributeNS(null, 'height', pf(h));
@ -6946,14 +7052,14 @@ var SVGGraphics = function SVGGraphics() { @@ -6946,14 +7052,14 @@ var SVGGraphics = function SVGGraphics() {
var width = imgData.width;
var height = imgData.height;
var imgSrc = convertImgDataToPng(imgData, this.forceDataSchema);
var cliprect = document.createElementNS(NS, 'svg:rect');
var cliprect = this.svgFactory.createElement('svg:rect');
cliprect.setAttributeNS(null, 'x', '0');
cliprect.setAttributeNS(null, 'y', '0');
cliprect.setAttributeNS(null, 'width', pf(width));
cliprect.setAttributeNS(null, 'height', pf(height));
this.current.element = cliprect;
this.clip('nonzero');
var imgEl = document.createElementNS(NS, 'svg:image');
var imgEl = this.svgFactory.createElement('svg:image');
imgEl.setAttributeNS(XLINK_NS, 'xlink:href', imgSrc);
imgEl.setAttributeNS(null, 'x', '0');
imgEl.setAttributeNS(null, 'y', pf(-height));
@ -6972,9 +7078,9 @@ var SVGGraphics = function SVGGraphics() { @@ -6972,9 +7078,9 @@ var SVGGraphics = function SVGGraphics() {
var height = imgData.height;
var fillColor = current.fillColor;
current.maskId = 'mask' + maskCount++;
var mask = document.createElementNS(NS, 'svg:mask');
var mask = this.svgFactory.createElement('svg:mask');
mask.setAttributeNS(null, 'id', current.maskId);
var rect = document.createElementNS(NS, 'svg:rect');
var rect = this.svgFactory.createElement('svg:rect');
rect.setAttributeNS(null, 'x', '0');
rect.setAttributeNS(null, 'y', '0');
rect.setAttributeNS(null, 'width', pf(width));
@ -6992,7 +7098,7 @@ var SVGGraphics = function SVGGraphics() { @@ -6992,7 +7098,7 @@ var SVGGraphics = function SVGGraphics() {
if (Array.isArray(bbox) && bbox.length === 4) {
var width = bbox[2] - bbox[0];
var height = bbox[3] - bbox[1];
var cliprect = document.createElementNS(NS, 'svg:rect');
var cliprect = this.svgFactory.createElement('svg:rect');
cliprect.setAttributeNS(null, 'x', bbox[0]);
cliprect.setAttributeNS(null, 'y', bbox[1]);
cliprect.setAttributeNS(null, 'width', pf(width));
@ -7003,25 +7109,21 @@ var SVGGraphics = function SVGGraphics() { @@ -7003,25 +7109,21 @@ var SVGGraphics = function SVGGraphics() {
}
},
paintFormXObjectEnd: function SVGGraphics_paintFormXObjectEnd() {},
_initialize: function SVGGraphics_initialize(viewport) {
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, 'preserveAspectRatio', 'none');
svg.setAttributeNS(null, 'viewBox', '0 0 ' + viewport.width + ' ' + viewport.height);
var definitions = document.createElementNS(NS, 'svg:defs');
_initialize: function _initialize(viewport) {
var svg = this.svgFactory.create(viewport.width, viewport.height);
var definitions = this.svgFactory.createElement('svg:defs');
svg.appendChild(definitions);
this.defs = definitions;
var rootGroup = document.createElementNS(NS, 'svg:g');
var rootGroup = this.svgFactory.createElement('svg:g');
rootGroup.setAttributeNS(null, 'transform', pm(viewport.transform));
svg.appendChild(rootGroup);
this.svg = rootGroup;
return svg;
},
_ensureClipGroup: function SVGGraphics_ensureClipGroup() {
if (!this.current.clipGroup) {
var clipGroup = document.createElementNS(NS, 'svg:g');
var clipGroup = this.svgFactory.createElement('svg:g');
clipGroup.setAttributeNS(null, 'clip-path', this.current.activeClipUrl);
this.svg.appendChild(clipGroup);
this.current.clipGroup = clipGroup;
@ -7030,7 +7132,7 @@ var SVGGraphics = function SVGGraphics() { @@ -7030,7 +7132,7 @@ var SVGGraphics = function SVGGraphics() {
},
_ensureTransformGroup: function SVGGraphics_ensureTransformGroup() {
if (!this.tgrp) {
this.tgrp = document.createElementNS(NS, 'svg:g');
this.tgrp = this.svgFactory.createElement('svg:g');
this.tgrp.setAttributeNS(null, 'transform', pm(this.transformMatrix));
if (this.current.activeClipUrl) {
this._ensureClipGroup().appendChild(this.tgrp);
@ -7053,14 +7155,14 @@ exports.SVGGraphics = SVGGraphics; @@ -7053,14 +7155,14 @@ exports.SVGGraphics = SVGGraphics;
"use strict";
var pdfjsVersion = '1.9.544';
var pdfjsBuild = '437e9cb0';
var pdfjsVersion = '1.9.549';
var pdfjsBuild = '320779e6';
var pdfjsSharedUtil = __w_pdfjs_require__(0);
var pdfjsDisplayGlobal = __w_pdfjs_require__(82);
var pdfjsDisplayAPI = __w_pdfjs_require__(48);
var pdfjsDisplayTextLayer = __w_pdfjs_require__(52);
var pdfjsDisplayAnnotationLayer = __w_pdfjs_require__(51);
var pdfjsDisplayDOMUtils = __w_pdfjs_require__(8);
var pdfjsDisplayDOMUtils = __w_pdfjs_require__(7);
var pdfjsDisplaySVG = __w_pdfjs_require__(53);
{
if (pdfjsSharedUtil.isNodeJS()) {
@ -8695,7 +8797,7 @@ if (__w_pdfjs_require__(3)) { @@ -8695,7 +8797,7 @@ if (__w_pdfjs_require__(3)) {
var setSpecies = __w_pdfjs_require__(76);
var arrayFill = __w_pdfjs_require__(44);
var arrayCopyWithin = __w_pdfjs_require__(77);
var $DP = __w_pdfjs_require__(7);
var $DP = __w_pdfjs_require__(8);
var $GOPD = __w_pdfjs_require__(78);
var dP = $DP.f;
var gOPD = $GOPD.f;
@ -9112,7 +9214,7 @@ var toInteger = __w_pdfjs_require__(12); @@ -9112,7 +9214,7 @@ var toInteger = __w_pdfjs_require__(12);
var toLength = __w_pdfjs_require__(6);
var toIndex = __w_pdfjs_require__(37);
var gOPN = __w_pdfjs_require__(38).f;
var dP = __w_pdfjs_require__(7).f;
var dP = __w_pdfjs_require__(8).f;
var arrayFill = __w_pdfjs_require__(44);
var setToStringTag = __w_pdfjs_require__(28);
var ARRAY_BUFFER = 'ArrayBuffer';
@ -9391,7 +9493,7 @@ module.exports = function (it) { @@ -9391,7 +9493,7 @@ module.exports = function (it) {
"use strict";
var dP = __w_pdfjs_require__(7);
var dP = __w_pdfjs_require__(8);
var anObject = __w_pdfjs_require__(17);
var getKeys = __w_pdfjs_require__(62);
module.exports = __w_pdfjs_require__(3) ? Object.defineProperties : function defineProperties(O, Properties) {
@ -9758,7 +9860,7 @@ module.exports = function (exec, skipClosing) { @@ -9758,7 +9860,7 @@ module.exports = function (exec, skipClosing) {
var global = __w_pdfjs_require__(2);
var dP = __w_pdfjs_require__(7);
var dP = __w_pdfjs_require__(8);
var DESCRIPTORS = __w_pdfjs_require__(3);
var SPECIES = __w_pdfjs_require__(1)('species');
module.exports = function (KEY) {
@ -12892,7 +12994,7 @@ exports.PDFJS = exports.isWorker = exports.globalScope = undefined; @@ -12892,7 +12994,7 @@ exports.PDFJS = exports.isWorker = exports.globalScope = undefined;
var _api = __w_pdfjs_require__(48);
var _dom_utils = __w_pdfjs_require__(8);
var _dom_utils = __w_pdfjs_require__(7);
var _util = __w_pdfjs_require__(0);
@ -12916,8 +13018,8 @@ if (!_global_scope2.default.PDFJS) { @@ -12916,8 +13018,8 @@ if (!_global_scope2.default.PDFJS) {
}
var PDFJS = _global_scope2.default.PDFJS;
{
PDFJS.version = '1.9.544';
PDFJS.build = '437e9cb0';
PDFJS.version = '1.9.549';
PDFJS.build = '320779e6';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {

2
build/pdf.js.map

File diff suppressed because one or more lines are too long

2
build/pdf.min.js vendored

File diff suppressed because one or more lines are too long

102
build/pdf.worker.js vendored

@ -24512,8 +24512,8 @@ exports.getUnicodeForGlyph = getUnicodeForGlyph; @@ -24512,8 +24512,8 @@ exports.getUnicodeForGlyph = getUnicodeForGlyph;
"use strict";
var pdfjsVersion = '1.9.544';
var pdfjsBuild = '437e9cb0';
var pdfjsVersion = '1.9.549';
var pdfjsBuild = '320779e6';
var pdfjsCoreWorker = __w_pdfjs_require__(62);
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
@ -43133,6 +43133,10 @@ var AnnotationFactory = function () { @@ -43133,6 +43133,10 @@ var AnnotationFactory = function () {
return new PopupAnnotation(parameters);
case 'Line':
return new LineAnnotation(parameters);
case 'Square':
return new SquareAnnotation(parameters);
case 'Circle':
return new CircleAnnotation(parameters);
case 'Highlight':
return new HighlightAnnotation(parameters);
case 'Underline':
@ -43769,83 +43773,115 @@ var LineAnnotation = function (_Annotation5) { @@ -43769,83 +43773,115 @@ var LineAnnotation = function (_Annotation5) {
return LineAnnotation;
}(Annotation);
var HighlightAnnotation = function (_Annotation6) {
_inherits(HighlightAnnotation, _Annotation6);
var SquareAnnotation = function (_Annotation6) {
_inherits(SquareAnnotation, _Annotation6);
function HighlightAnnotation(parameters) {
_classCallCheck(this, HighlightAnnotation);
function SquareAnnotation(parameters) {
_classCallCheck(this, SquareAnnotation);
var _this10 = _possibleConstructorReturn(this, (HighlightAnnotation.__proto__ || Object.getPrototypeOf(HighlightAnnotation)).call(this, parameters));
var _this10 = _possibleConstructorReturn(this, (SquareAnnotation.__proto__ || Object.getPrototypeOf(SquareAnnotation)).call(this, parameters));
_this10.data.annotationType = _util.AnnotationType.HIGHLIGHT;
_this10.data.annotationType = _util.AnnotationType.SQUARE;
_this10._preparePopup(parameters.dict);
return _this10;
}
return SquareAnnotation;
}(Annotation);
var CircleAnnotation = function (_Annotation7) {
_inherits(CircleAnnotation, _Annotation7);
function CircleAnnotation(parameters) {
_classCallCheck(this, CircleAnnotation);
var _this11 = _possibleConstructorReturn(this, (CircleAnnotation.__proto__ || Object.getPrototypeOf(CircleAnnotation)).call(this, parameters));
_this11.data.annotationType = _util.AnnotationType.CIRCLE;
_this11._preparePopup(parameters.dict);
return _this11;
}
return CircleAnnotation;
}(Annotation);
var HighlightAnnotation = function (_Annotation8) {
_inherits(HighlightAnnotation, _Annotation8);
function HighlightAnnotation(parameters) {
_classCallCheck(this, HighlightAnnotation);
var _this12 = _possibleConstructorReturn(this, (HighlightAnnotation.__proto__ || Object.getPrototypeOf(HighlightAnnotation)).call(this, parameters));
_this12.data.annotationType = _util.AnnotationType.HIGHLIGHT;
_this12._preparePopup(parameters.dict);
return _this12;
}
return HighlightAnnotation;
}(Annotation);
var UnderlineAnnotation = function (_Annotation7) {
_inherits(UnderlineAnnotation, _Annotation7);
var UnderlineAnnotation = function (_Annotation9) {
_inherits(UnderlineAnnotation, _Annotation9);
function UnderlineAnnotation(parameters) {
_classCallCheck(this, UnderlineAnnotation);
var _this11 = _possibleConstructorReturn(this, (UnderlineAnnotation.__proto__ || Object.getPrototypeOf(UnderlineAnnotation)).call(this, parameters));
var _this13 = _possibleConstructorReturn(this, (UnderlineAnnotation.__proto__ || Object.getPrototypeOf(UnderlineAnnotation)).call(this, parameters));
_this11.data.annotationType = _util.AnnotationType.UNDERLINE;
_this11._preparePopup(parameters.dict);
return _this11;
_this13.data.annotationType = _util.AnnotationType.UNDERLINE;
_this13._preparePopup(parameters.dict);
return _this13;
}
return UnderlineAnnotation;
}(Annotation);
var SquigglyAnnotation = function (_Annotation8) {
_inherits(SquigglyAnnotation, _Annotation8);
var SquigglyAnnotation = function (_Annotation10) {
_inherits(SquigglyAnnotation, _Annotation10);
function SquigglyAnnotation(parameters) {
_classCallCheck(this, SquigglyAnnotation);
var _this12 = _possibleConstructorReturn(this, (SquigglyAnnotation.__proto__ || Object.getPrototypeOf(SquigglyAnnotation)).call(this, parameters));
var _this14 = _possibleConstructorReturn(this, (SquigglyAnnotation.__proto__ || Object.getPrototypeOf(SquigglyAnnotation)).call(this, parameters));
_this12.data.annotationType = _util.AnnotationType.SQUIGGLY;
_this12._preparePopup(parameters.dict);
return _this12;
_this14.data.annotationType = _util.AnnotationType.SQUIGGLY;
_this14._preparePopup(parameters.dict);
return _this14;
}
return SquigglyAnnotation;
}(Annotation);
var StrikeOutAnnotation = function (_Annotation9) {
_inherits(StrikeOutAnnotation, _Annotation9);
var StrikeOutAnnotation = function (_Annotation11) {
_inherits(StrikeOutAnnotation, _Annotation11);
function StrikeOutAnnotation(parameters) {
_classCallCheck(this, StrikeOutAnnotation);
var _this13 = _possibleConstructorReturn(this, (StrikeOutAnnotation.__proto__ || Object.getPrototypeOf(StrikeOutAnnotation)).call(this, parameters));
var _this15 = _possibleConstructorReturn(this, (StrikeOutAnnotation.__proto__ || Object.getPrototypeOf(StrikeOutAnnotation)).call(this, parameters));
_this13.data.annotationType = _util.AnnotationType.STRIKEOUT;
_this13._preparePopup(parameters.dict);
return _this13;
_this15.data.annotationType = _util.AnnotationType.STRIKEOUT;
_this15._preparePopup(parameters.dict);
return _this15;
}
return StrikeOutAnnotation;
}(Annotation);
var FileAttachmentAnnotation = function (_Annotation10) {
_inherits(FileAttachmentAnnotation, _Annotation10);
var FileAttachmentAnnotation = function (_Annotation12) {
_inherits(FileAttachmentAnnotation, _Annotation12);
function FileAttachmentAnnotation(parameters) {
_classCallCheck(this, FileAttachmentAnnotation);
var _this14 = _possibleConstructorReturn(this, (FileAttachmentAnnotation.__proto__ || Object.getPrototypeOf(FileAttachmentAnnotation)).call(this, parameters));
var _this16 = _possibleConstructorReturn(this, (FileAttachmentAnnotation.__proto__ || Object.getPrototypeOf(FileAttachmentAnnotation)).call(this, parameters));
var file = new _obj.FileSpec(parameters.dict.get('FS'), parameters.xref);
_this14.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
_this14.data.file = file.serializable;
_this14._preparePopup(parameters.dict);
return _this14;
_this16.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
_this16.data.file = file.serializable;
_this16._preparePopup(parameters.dict);
return _this16;
}
return FileAttachmentAnnotation;

2
build/pdf.worker.js.map vendored

File diff suppressed because one or more lines are too long

2
build/pdf.worker.min.js vendored

File diff suppressed because one or more lines are too long

98
lib/core/annotation.js

@ -86,6 +86,10 @@ var AnnotationFactory = function () { @@ -86,6 +86,10 @@ var AnnotationFactory = function () {
return new PopupAnnotation(parameters);
case 'Line':
return new LineAnnotation(parameters);
case 'Square':
return new SquareAnnotation(parameters);
case 'Circle':
return new CircleAnnotation(parameters);
case 'Highlight':
return new HighlightAnnotation(parameters);
case 'Underline':
@ -722,83 +726,115 @@ var LineAnnotation = function (_Annotation5) { @@ -722,83 +726,115 @@ var LineAnnotation = function (_Annotation5) {
return LineAnnotation;
}(Annotation);
var HighlightAnnotation = function (_Annotation6) {
_inherits(HighlightAnnotation, _Annotation6);
var SquareAnnotation = function (_Annotation6) {
_inherits(SquareAnnotation, _Annotation6);
function HighlightAnnotation(parameters) {
_classCallCheck(this, HighlightAnnotation);
function SquareAnnotation(parameters) {
_classCallCheck(this, SquareAnnotation);
var _this10 = _possibleConstructorReturn(this, (HighlightAnnotation.__proto__ || Object.getPrototypeOf(HighlightAnnotation)).call(this, parameters));
var _this10 = _possibleConstructorReturn(this, (SquareAnnotation.__proto__ || Object.getPrototypeOf(SquareAnnotation)).call(this, parameters));
_this10.data.annotationType = _util.AnnotationType.HIGHLIGHT;
_this10.data.annotationType = _util.AnnotationType.SQUARE;
_this10._preparePopup(parameters.dict);
return _this10;
}
return SquareAnnotation;
}(Annotation);
var CircleAnnotation = function (_Annotation7) {
_inherits(CircleAnnotation, _Annotation7);
function CircleAnnotation(parameters) {
_classCallCheck(this, CircleAnnotation);
var _this11 = _possibleConstructorReturn(this, (CircleAnnotation.__proto__ || Object.getPrototypeOf(CircleAnnotation)).call(this, parameters));
_this11.data.annotationType = _util.AnnotationType.CIRCLE;
_this11._preparePopup(parameters.dict);
return _this11;
}
return CircleAnnotation;
}(Annotation);
var HighlightAnnotation = function (_Annotation8) {
_inherits(HighlightAnnotation, _Annotation8);
function HighlightAnnotation(parameters) {
_classCallCheck(this, HighlightAnnotation);
var _this12 = _possibleConstructorReturn(this, (HighlightAnnotation.__proto__ || Object.getPrototypeOf(HighlightAnnotation)).call(this, parameters));
_this12.data.annotationType = _util.AnnotationType.HIGHLIGHT;
_this12._preparePopup(parameters.dict);
return _this12;
}
return HighlightAnnotation;
}(Annotation);
var UnderlineAnnotation = function (_Annotation7) {
_inherits(UnderlineAnnotation, _Annotation7);
var UnderlineAnnotation = function (_Annotation9) {
_inherits(UnderlineAnnotation, _Annotation9);
function UnderlineAnnotation(parameters) {
_classCallCheck(this, UnderlineAnnotation);
var _this11 = _possibleConstructorReturn(this, (UnderlineAnnotation.__proto__ || Object.getPrototypeOf(UnderlineAnnotation)).call(this, parameters));
var _this13 = _possibleConstructorReturn(this, (UnderlineAnnotation.__proto__ || Object.getPrototypeOf(UnderlineAnnotation)).call(this, parameters));
_this11.data.annotationType = _util.AnnotationType.UNDERLINE;
_this11._preparePopup(parameters.dict);
return _this11;
_this13.data.annotationType = _util.AnnotationType.UNDERLINE;
_this13._preparePopup(parameters.dict);
return _this13;
}
return UnderlineAnnotation;
}(Annotation);
var SquigglyAnnotation = function (_Annotation8) {
_inherits(SquigglyAnnotation, _Annotation8);
var SquigglyAnnotation = function (_Annotation10) {
_inherits(SquigglyAnnotation, _Annotation10);
function SquigglyAnnotation(parameters) {
_classCallCheck(this, SquigglyAnnotation);
var _this12 = _possibleConstructorReturn(this, (SquigglyAnnotation.__proto__ || Object.getPrototypeOf(SquigglyAnnotation)).call(this, parameters));
var _this14 = _possibleConstructorReturn(this, (SquigglyAnnotation.__proto__ || Object.getPrototypeOf(SquigglyAnnotation)).call(this, parameters));
_this12.data.annotationType = _util.AnnotationType.SQUIGGLY;
_this12._preparePopup(parameters.dict);
return _this12;
_this14.data.annotationType = _util.AnnotationType.SQUIGGLY;
_this14._preparePopup(parameters.dict);
return _this14;
}
return SquigglyAnnotation;
}(Annotation);
var StrikeOutAnnotation = function (_Annotation9) {
_inherits(StrikeOutAnnotation, _Annotation9);
var StrikeOutAnnotation = function (_Annotation11) {
_inherits(StrikeOutAnnotation, _Annotation11);
function StrikeOutAnnotation(parameters) {
_classCallCheck(this, StrikeOutAnnotation);
var _this13 = _possibleConstructorReturn(this, (StrikeOutAnnotation.__proto__ || Object.getPrototypeOf(StrikeOutAnnotation)).call(this, parameters));
var _this15 = _possibleConstructorReturn(this, (StrikeOutAnnotation.__proto__ || Object.getPrototypeOf(StrikeOutAnnotation)).call(this, parameters));
_this13.data.annotationType = _util.AnnotationType.STRIKEOUT;
_this13._preparePopup(parameters.dict);
return _this13;
_this15.data.annotationType = _util.AnnotationType.STRIKEOUT;
_this15._preparePopup(parameters.dict);
return _this15;
}
return StrikeOutAnnotation;
}(Annotation);
var FileAttachmentAnnotation = function (_Annotation10) {
_inherits(FileAttachmentAnnotation, _Annotation10);
var FileAttachmentAnnotation = function (_Annotation12) {
_inherits(FileAttachmentAnnotation, _Annotation12);
function FileAttachmentAnnotation(parameters) {
_classCallCheck(this, FileAttachmentAnnotation);
var _this14 = _possibleConstructorReturn(this, (FileAttachmentAnnotation.__proto__ || Object.getPrototypeOf(FileAttachmentAnnotation)).call(this, parameters));
var _this16 = _possibleConstructorReturn(this, (FileAttachmentAnnotation.__proto__ || Object.getPrototypeOf(FileAttachmentAnnotation)).call(this, parameters));
var file = new _obj.FileSpec(parameters.dict.get('FS'), parameters.xref);
_this14.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
_this14.data.file = file.serializable;
_this14._preparePopup(parameters.dict);
return _this14;
_this16.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
_this16.data.file = file.serializable;
_this16._preparePopup(parameters.dict);
return _this16;
}
return FileAttachmentAnnotation;

140
lib/display/annotation_layer.js

@ -66,6 +66,10 @@ var AnnotationElementFactory = function () { @@ -66,6 +66,10 @@ var AnnotationElementFactory = function () {
return new PopupAnnotationElement(parameters);
case _util.AnnotationType.LINE:
return new LineAnnotationElement(parameters);
case _util.AnnotationType.SQUARE:
return new SquareAnnotationElement(parameters);
case _util.AnnotationType.CIRCLE:
return new CircleAnnotationElement(parameters);
case _util.AnnotationType.HIGHLIGHT:
return new HighlightAnnotationElement(parameters);
case _util.AnnotationType.UNDERLINE:
@ -101,6 +105,7 @@ var AnnotationElement = function () { @@ -101,6 +105,7 @@ var AnnotationElement = function () {
this.downloadManager = parameters.downloadManager;
this.imageResourcesPath = parameters.imageResourcesPath;
this.renderInteractiveForms = parameters.renderInteractiveForms;
this.svgFactory = parameters.svgFactory;
if (isRenderable) {
this.container = this._createContainer(ignoreBorder);
}
@ -487,7 +492,7 @@ var PopupAnnotationElement = function (_AnnotationElement4) { @@ -487,7 +492,7 @@ var PopupAnnotationElement = function (_AnnotationElement4) {
_createClass(PopupAnnotationElement, [{
key: 'render',
value: function render() {
var IGNORE_TYPES = ['Line'];
var IGNORE_TYPES = ['Line', 'Square', 'Circle'];
this.container.className = 'popupAnnotation';
if (IGNORE_TYPES.indexOf(this.data.parentType) >= 0) {
return this.container;
@ -625,27 +630,21 @@ var LineAnnotationElement = function (_AnnotationElement5) { @@ -625,27 +630,21 @@ var LineAnnotationElement = function (_AnnotationElement5) {
_createClass(LineAnnotationElement, [{
key: 'render',
value: function render() {
var SVG_NS = 'http://www.w3.org/2000/svg';
this.container.className = 'lineAnnotation';
var data = this.data;
var width = data.rect[2] - data.rect[0];
var height = data.rect[3] - data.rect[1];
var svg = document.createElementNS(SVG_NS, 'svg:svg');
svg.setAttributeNS(null, 'version', '1.1');
svg.setAttributeNS(null, 'width', width + 'px');
svg.setAttributeNS(null, 'height', height + 'px');
svg.setAttributeNS(null, 'preserveAspectRatio', 'none');
svg.setAttributeNS(null, 'viewBox', '0 0 ' + width + ' ' + height);
var line = document.createElementNS(SVG_NS, 'svg:line');
line.setAttributeNS(null, 'x1', data.rect[2] - data.lineCoordinates[0]);
line.setAttributeNS(null, 'y1', data.rect[3] - data.lineCoordinates[1]);
line.setAttributeNS(null, 'x2', data.rect[2] - data.lineCoordinates[2]);
line.setAttributeNS(null, 'y2', data.rect[3] - data.lineCoordinates[3]);
line.setAttributeNS(null, 'stroke-width', data.borderStyle.width);
line.setAttributeNS(null, 'stroke', 'transparent');
var svg = this.svgFactory.create(width, height);
var line = this.svgFactory.createElement('svg:line');
line.setAttribute('x1', data.rect[2] - data.lineCoordinates[0]);
line.setAttribute('y1', data.rect[3] - data.lineCoordinates[1]);
line.setAttribute('x2', data.rect[2] - data.lineCoordinates[2]);
line.setAttribute('y2', data.rect[3] - data.lineCoordinates[3]);
line.setAttribute('stroke-width', data.borderStyle.width);
line.setAttribute('stroke', 'transparent');
svg.appendChild(line);
this.container.append(svg);
this._createPopup(this.container, line, this.data);
this._createPopup(this.container, line, data);
return this.container;
}
}]);
@ -653,8 +652,82 @@ var LineAnnotationElement = function (_AnnotationElement5) { @@ -653,8 +652,82 @@ var LineAnnotationElement = function (_AnnotationElement5) {
return LineAnnotationElement;
}(AnnotationElement);
var HighlightAnnotationElement = function (_AnnotationElement6) {
_inherits(HighlightAnnotationElement, _AnnotationElement6);
var SquareAnnotationElement = function (_AnnotationElement6) {
_inherits(SquareAnnotationElement, _AnnotationElement6);
function SquareAnnotationElement(parameters) {
_classCallCheck(this, SquareAnnotationElement);
var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
return _possibleConstructorReturn(this, (SquareAnnotationElement.__proto__ || Object.getPrototypeOf(SquareAnnotationElement)).call(this, parameters, isRenderable, true));
}
_createClass(SquareAnnotationElement, [{
key: 'render',
value: function render() {
this.container.className = 'squareAnnotation';
var data = this.data;
var width = data.rect[2] - data.rect[0];
var height = data.rect[3] - data.rect[1];
var svg = this.svgFactory.create(width, height);
var borderWidth = data.borderStyle.width;
var square = this.svgFactory.createElement('svg:rect');
square.setAttribute('x', borderWidth / 2);
square.setAttribute('y', borderWidth / 2);
square.setAttribute('width', width - borderWidth);
square.setAttribute('height', height - borderWidth);
square.setAttribute('stroke-width', borderWidth);
square.setAttribute('stroke', 'transparent');
square.setAttribute('fill', 'none');
svg.appendChild(square);
this.container.append(svg);
this._createPopup(this.container, square, data);
return this.container;
}
}]);
return SquareAnnotationElement;
}(AnnotationElement);
var CircleAnnotationElement = function (_AnnotationElement7) {
_inherits(CircleAnnotationElement, _AnnotationElement7);
function CircleAnnotationElement(parameters) {
_classCallCheck(this, CircleAnnotationElement);
var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
return _possibleConstructorReturn(this, (CircleAnnotationElement.__proto__ || Object.getPrototypeOf(CircleAnnotationElement)).call(this, parameters, isRenderable, true));
}
_createClass(CircleAnnotationElement, [{
key: 'render',
value: function render() {
this.container.className = 'circleAnnotation';
var data = this.data;
var width = data.rect[2] - data.rect[0];
var height = data.rect[3] - data.rect[1];
var svg = this.svgFactory.create(width, height);
var borderWidth = data.borderStyle.width;
var circle = this.svgFactory.createElement('svg:ellipse');
circle.setAttribute('cx', width / 2);
circle.setAttribute('cy', height / 2);
circle.setAttribute('rx', width / 2 - borderWidth / 2);
circle.setAttribute('ry', height / 2 - borderWidth / 2);
circle.setAttribute('stroke-width', borderWidth);
circle.setAttribute('stroke', 'transparent');
circle.setAttribute('fill', 'none');
svg.appendChild(circle);
this.container.append(svg);
this._createPopup(this.container, circle, data);
return this.container;
}
}]);
return CircleAnnotationElement;
}(AnnotationElement);
var HighlightAnnotationElement = function (_AnnotationElement8) {
_inherits(HighlightAnnotationElement, _AnnotationElement8);
function HighlightAnnotationElement(parameters) {
_classCallCheck(this, HighlightAnnotationElement);
@ -677,8 +750,8 @@ var HighlightAnnotationElement = function (_AnnotationElement6) { @@ -677,8 +750,8 @@ var HighlightAnnotationElement = function (_AnnotationElement6) {
return HighlightAnnotationElement;
}(AnnotationElement);
var UnderlineAnnotationElement = function (_AnnotationElement7) {
_inherits(UnderlineAnnotationElement, _AnnotationElement7);
var UnderlineAnnotationElement = function (_AnnotationElement9) {
_inherits(UnderlineAnnotationElement, _AnnotationElement9);
function UnderlineAnnotationElement(parameters) {
_classCallCheck(this, UnderlineAnnotationElement);
@ -701,8 +774,8 @@ var UnderlineAnnotationElement = function (_AnnotationElement7) { @@ -701,8 +774,8 @@ var UnderlineAnnotationElement = function (_AnnotationElement7) {
return UnderlineAnnotationElement;
}(AnnotationElement);
var SquigglyAnnotationElement = function (_AnnotationElement8) {
_inherits(SquigglyAnnotationElement, _AnnotationElement8);
var SquigglyAnnotationElement = function (_AnnotationElement10) {
_inherits(SquigglyAnnotationElement, _AnnotationElement10);
function SquigglyAnnotationElement(parameters) {
_classCallCheck(this, SquigglyAnnotationElement);
@ -725,8 +798,8 @@ var SquigglyAnnotationElement = function (_AnnotationElement8) { @@ -725,8 +798,8 @@ var SquigglyAnnotationElement = function (_AnnotationElement8) {
return SquigglyAnnotationElement;
}(AnnotationElement);
var StrikeOutAnnotationElement = function (_AnnotationElement9) {
_inherits(StrikeOutAnnotationElement, _AnnotationElement9);
var StrikeOutAnnotationElement = function (_AnnotationElement11) {
_inherits(StrikeOutAnnotationElement, _AnnotationElement11);
function StrikeOutAnnotationElement(parameters) {
_classCallCheck(this, StrikeOutAnnotationElement);
@ -749,23 +822,23 @@ var StrikeOutAnnotationElement = function (_AnnotationElement9) { @@ -749,23 +822,23 @@ var StrikeOutAnnotationElement = function (_AnnotationElement9) {
return StrikeOutAnnotationElement;
}(AnnotationElement);
var FileAttachmentAnnotationElement = function (_AnnotationElement10) {
_inherits(FileAttachmentAnnotationElement, _AnnotationElement10);
var FileAttachmentAnnotationElement = function (_AnnotationElement12) {
_inherits(FileAttachmentAnnotationElement, _AnnotationElement12);
function FileAttachmentAnnotationElement(parameters) {
_classCallCheck(this, FileAttachmentAnnotationElement);
var _this16 = _possibleConstructorReturn(this, (FileAttachmentAnnotationElement.__proto__ || Object.getPrototypeOf(FileAttachmentAnnotationElement)).call(this, parameters, true));
var _this18 = _possibleConstructorReturn(this, (FileAttachmentAnnotationElement.__proto__ || Object.getPrototypeOf(FileAttachmentAnnotationElement)).call(this, parameters, true));
var file = _this16.data.file;
_this16.filename = (0, _dom_utils.getFilenameFromUrl)(file.filename);
_this16.content = file.content;
_this16.linkService.onFileAttachmentAnnotation({
var file = _this18.data.file;
_this18.filename = (0, _dom_utils.getFilenameFromUrl)(file.filename);
_this18.content = file.content;
_this18.linkService.onFileAttachmentAnnotation({
id: (0, _util.stringToPDFString)(file.filename),
filename: file.filename,
content: file.content
});
return _this16;
return _this18;
}
_createClass(FileAttachmentAnnotationElement, [{
@ -817,7 +890,8 @@ var AnnotationLayer = function () { @@ -817,7 +890,8 @@ var AnnotationLayer = function () {
linkService: parameters.linkService,
downloadManager: parameters.downloadManager,
imageResourcesPath: parameters.imageResourcesPath || (0, _dom_utils.getDefaultSetting)('imageResourcesPath'),
renderInteractiveForms: parameters.renderInteractiveForms || false
renderInteractiveForms: parameters.renderInteractiveForms || false,
svgFactory: new _dom_utils.DOMSVGFactory()
});
if (element.isRenderable) {
parameters.div.appendChild(element.render());

4
lib/display/api.js

@ -1581,8 +1581,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() { @@ -1581,8 +1581,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
}();
var version, build;
{
exports.version = version = '1.9.544';
exports.build = build = '437e9cb0';
exports.version = version = '1.9.549';
exports.build = build = '320779e6';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;

34
lib/display/dom_utils.js

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.DOMCMapReaderFactory = exports.DOMCanvasFactory = exports.DEFAULT_LINK_REL = exports.getDefaultSetting = exports.LinkTarget = exports.getFilenameFromUrl = exports.isValidUrl = exports.isExternalLinkTargetSet = exports.addLinkAttributes = exports.RenderingCancelledException = exports.CustomStyle = undefined;
exports.DOMSVGFactory = exports.DOMCMapReaderFactory = exports.DOMCanvasFactory = exports.DEFAULT_LINK_REL = exports.getDefaultSetting = exports.LinkTarget = exports.getFilenameFromUrl = exports.isValidUrl = exports.isExternalLinkTargetSet = exports.addLinkAttributes = exports.RenderingCancelledException = exports.CustomStyle = undefined;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
@ -32,6 +32,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de @@ -32,6 +32,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var DEFAULT_LINK_REL = 'noopener noreferrer nofollow';
var SVG_NS = 'http://www.w3.org/2000/svg';
var DOMCanvasFactory = function () {
function DOMCanvasFactory() {
@ -140,6 +141,34 @@ var DOMCMapReaderFactory = function () { @@ -140,6 +141,34 @@ var DOMCMapReaderFactory = function () {
return DOMCMapReaderFactory;
}();
var DOMSVGFactory = function () {
function DOMSVGFactory() {
_classCallCheck(this, DOMSVGFactory);
}
_createClass(DOMSVGFactory, [{
key: 'create',
value: function create(width, height) {
(0, _util.assert)(width > 0 && height > 0, 'Invalid SVG dimensions');
var svg = document.createElementNS(SVG_NS, 'svg:svg');
svg.setAttribute('version', '1.1');
svg.setAttribute('width', width + 'px');
svg.setAttribute('height', height + 'px');
svg.setAttribute('preserveAspectRatio', 'none');
svg.setAttribute('viewBox', '0 0 ' + width + ' ' + height);
return svg;
}
}, {
key: 'createElement',
value: function createElement(type) {
(0, _util.assert)(typeof type === 'string', 'Invalid SVG element type');
return document.createElementNS(SVG_NS, type);
}
}]);
return DOMSVGFactory;
}();
var CustomStyle = function CustomStyleClosure() {
var prefixes = ['ms', 'Moz', 'Webkit', 'O'];
var _cache = Object.create(null);
@ -299,4 +328,5 @@ exports.LinkTarget = LinkTarget; @@ -299,4 +328,5 @@ exports.LinkTarget = LinkTarget;
exports.getDefaultSetting = getDefaultSetting;
exports.DEFAULT_LINK_REL = DEFAULT_LINK_REL;
exports.DOMCanvasFactory = DOMCanvasFactory;
exports.DOMCMapReaderFactory = DOMCMapReaderFactory;
exports.DOMCMapReaderFactory = DOMCMapReaderFactory;
exports.DOMSVGFactory = DOMSVGFactory;

4
lib/display/global.js

@ -45,8 +45,8 @@ if (!_global_scope2.default.PDFJS) { @@ -45,8 +45,8 @@ if (!_global_scope2.default.PDFJS) {
}
var PDFJS = _global_scope2.default.PDFJS;
{
PDFJS.version = '1.9.544';
PDFJS.build = '437e9cb0';
PDFJS.version = '1.9.549';
PDFJS.build = '320779e6';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {

58
lib/display/svg.js

@ -21,6 +21,8 @@ exports.SVGGraphics = undefined; @@ -21,6 +21,8 @@ exports.SVGGraphics = undefined;
var _util = require('../shared/util');
var _dom_utils = require('./dom_utils');
var SVGGraphics = function SVGGraphics() {
throw new Error('Not implemented: SVGGraphics');
};
@ -298,6 +300,7 @@ var SVGGraphics = function SVGGraphics() { @@ -298,6 +300,7 @@ var SVGGraphics = function SVGGraphics() {
return 'matrix(' + pf(m[0]) + ' ' + pf(m[1]) + ' ' + pf(m[2]) + ' ' + pf(m[3]) + ' ' + pf(m[4]) + ' ' + pf(m[5]) + ')';
}
function SVGGraphics(commonObjs, objs, forceDataSchema) {
this.svgFactory = new _dom_utils.DOMSVGFactory();
this.current = new SVGExtraState();
this.transformMatrix = _util.IDENTITY_MATRIX;
this.transformStack = [];
@ -311,7 +314,6 @@ var SVGGraphics = function SVGGraphics() { @@ -311,7 +314,6 @@ var SVGGraphics = function SVGGraphics() {
this.cssStyle = null;
this.forceDataSchema = !!forceDataSchema;
}
var NS = 'http://www.w3.org/2000/svg';
var XML_NS = 'http://www.w3.org/XML/1998/namespace';
var XLINK_NS = 'http://www.w3.org/1999/xlink';
var LINE_CAP_STYLES = ['butt', 'round', 'square'];
@ -557,11 +559,11 @@ var SVGGraphics = function SVGGraphics() { @@ -557,11 +559,11 @@ var SVGGraphics = function SVGGraphics() {
this.current.x = this.current.lineX = 0;
this.current.y = this.current.lineY = 0;
current.xcoords = [];
current.tspan = document.createElementNS(NS, 'svg:tspan');
current.tspan = this.svgFactory.createElement('svg:tspan');
current.tspan.setAttributeNS(null, 'font-family', current.fontFamily);
current.tspan.setAttributeNS(null, 'font-size', pf(current.fontSize) + 'px');
current.tspan.setAttributeNS(null, 'y', pf(-current.y));
current.txtElement = document.createElementNS(NS, 'svg:text');
current.txtElement = this.svgFactory.createElement('svg:text');
current.txtElement.appendChild(current.tspan);
},
beginText: function SVGGraphics_beginText() {
@ -569,9 +571,9 @@ var SVGGraphics = function SVGGraphics() { @@ -569,9 +571,9 @@ var SVGGraphics = function SVGGraphics() {
this.current.y = this.current.lineY = 0;
this.current.textMatrix = _util.IDENTITY_MATRIX;
this.current.lineMatrix = _util.IDENTITY_MATRIX;
this.current.tspan = document.createElementNS(NS, 'svg:tspan');
this.current.txtElement = document.createElementNS(NS, 'svg:text');
this.current.txtgrp = document.createElementNS(NS, 'svg:g');
this.current.tspan = this.svgFactory.createElement('svg:tspan');
this.current.txtElement = this.svgFactory.createElement('svg:text');
this.current.txtgrp = this.svgFactory.createElement('svg:g');
this.current.xcoords = [];
},
moveText: function SVGGraphics_moveText(x, y) {
@ -579,7 +581,7 @@ var SVGGraphics = function SVGGraphics() { @@ -579,7 +581,7 @@ var SVGGraphics = function SVGGraphics() {
this.current.x = this.current.lineX += x;
this.current.y = this.current.lineY += y;
current.xcoords = [];
current.tspan = document.createElementNS(NS, 'svg:tspan');
current.tspan = this.svgFactory.createElement('svg:tspan');
current.tspan.setAttributeNS(null, 'font-family', current.fontFamily);
current.tspan.setAttributeNS(null, 'font-size', pf(current.fontSize) + 'px');
current.tspan.setAttributeNS(null, 'y', pf(-current.y));
@ -656,7 +658,7 @@ var SVGGraphics = function SVGGraphics() { @@ -656,7 +658,7 @@ var SVGGraphics = function SVGGraphics() {
},
addFontStyle: function SVGGraphics_addFontStyle(fontObj) {
if (!this.cssStyle) {
this.cssStyle = document.createElementNS(NS, 'svg:style');
this.cssStyle = this.svgFactory.createElement('svg:style');
this.cssStyle.setAttributeNS(null, 'type', 'text/css');
this.defs.appendChild(this.cssStyle);
}
@ -685,7 +687,7 @@ var SVGGraphics = function SVGGraphics() { @@ -685,7 +687,7 @@ var SVGGraphics = function SVGGraphics() {
current.fontFamily = fontObj.loadedName;
current.fontWeight = bold;
current.fontStyle = italic;
current.tspan = document.createElementNS(NS, 'svg:tspan');
current.tspan = this.svgFactory.createElement('svg:tspan');
current.tspan.setAttributeNS(null, 'y', pf(-current.y));
current.xcoords = [];
},
@ -715,7 +717,7 @@ var SVGGraphics = function SVGGraphics() { @@ -715,7 +717,7 @@ var SVGGraphics = function SVGGraphics() {
setFillRGBColor: function SVGGraphics_setFillRGBColor(r, g, b) {
var color = _util.Util.makeCssRgb(r, g, b);
this.current.fillColor = color;
this.current.tspan = document.createElementNS(NS, 'svg:tspan');
this.current.tspan = this.svgFactory.createElement('svg:tspan');
this.current.xcoords = [];
},
setDash: function SVGGraphics_setDash(dashArray, dashPhase) {
@ -726,7 +728,7 @@ var SVGGraphics = function SVGGraphics() { @@ -726,7 +728,7 @@ var SVGGraphics = function SVGGraphics() {
var current = this.current;
var x = current.x,
y = current.y;
current.path = document.createElementNS(NS, 'svg:path');
current.path = this.svgFactory.createElement('svg:path');
var d = [];
var opLength = ops.length;
for (var i = 0, j = 0; i < opLength; i++) {
@ -786,7 +788,7 @@ var SVGGraphics = function SVGGraphics() { @@ -786,7 +788,7 @@ var SVGGraphics = function SVGGraphics() {
var current = this.current;
var clipId = 'clippath' + clipCount;
clipCount++;
var clipPath = document.createElementNS(NS, 'svg:clipPath');
var clipPath = this.svgFactory.createElement('svg:clipPath');
clipPath.setAttributeNS(null, 'id', clipId);
clipPath.setAttributeNS(null, 'transform', pm(this.transformMatrix));
var clipElement = current.element.cloneNode();
@ -900,7 +902,7 @@ var SVGGraphics = function SVGGraphics() { @@ -900,7 +902,7 @@ var SVGGraphics = function SVGGraphics() {
},
paintSolidColorImageMask: function SVGGraphics_paintSolidColorImageMask() {
var current = this.current;
var rect = document.createElementNS(NS, 'svg:rect');
var rect = this.svgFactory.createElement('svg:rect');
rect.setAttributeNS(null, 'x', '0');
rect.setAttributeNS(null, 'y', '0');
rect.setAttributeNS(null, 'width', '1px');
@ -910,7 +912,7 @@ var SVGGraphics = function SVGGraphics() { @@ -910,7 +912,7 @@ var SVGGraphics = function SVGGraphics() {
},
paintJpegXObject: function SVGGraphics_paintJpegXObject(objId, w, h) {
var imgObj = this.objs.get(objId);
var imgEl = document.createElementNS(NS, 'svg:image');
var imgEl = this.svgFactory.createElement('svg:image');
imgEl.setAttributeNS(XLINK_NS, 'xlink:href', imgObj.src);
imgEl.setAttributeNS(null, 'width', pf(w));
imgEl.setAttributeNS(null, 'height', pf(h));
@ -931,14 +933,14 @@ var SVGGraphics = function SVGGraphics() { @@ -931,14 +933,14 @@ var SVGGraphics = function SVGGraphics() {
var width = imgData.width;
var height = imgData.height;
var imgSrc = convertImgDataToPng(imgData, this.forceDataSchema);
var cliprect = document.createElementNS(NS, 'svg:rect');
var cliprect = this.svgFactory.createElement('svg:rect');
cliprect.setAttributeNS(null, 'x', '0');
cliprect.setAttributeNS(null, 'y', '0');
cliprect.setAttributeNS(null, 'width', pf(width));
cliprect.setAttributeNS(null, 'height', pf(height));
this.current.element = cliprect;
this.clip('nonzero');
var imgEl = document.createElementNS(NS, 'svg:image');
var imgEl = this.svgFactory.createElement('svg:image');
imgEl.setAttributeNS(XLINK_NS, 'xlink:href', imgSrc);
imgEl.setAttributeNS(null, 'x', '0');
imgEl.setAttributeNS(null, 'y', pf(-height));
@ -957,9 +959,9 @@ var SVGGraphics = function SVGGraphics() { @@ -957,9 +959,9 @@ var SVGGraphics = function SVGGraphics() {
var height = imgData.height;
var fillColor = current.fillColor;
current.maskId = 'mask' + maskCount++;
var mask = document.createElementNS(NS, 'svg:mask');
var mask = this.svgFactory.createElement('svg:mask');
mask.setAttributeNS(null, 'id', current.maskId);
var rect = document.createElementNS(NS, 'svg:rect');
var rect = this.svgFactory.createElement('svg:rect');
rect.setAttributeNS(null, 'x', '0');
rect.setAttributeNS(null, 'y', '0');
rect.setAttributeNS(null, 'width', pf(width));
@ -977,7 +979,7 @@ var SVGGraphics = function SVGGraphics() { @@ -977,7 +979,7 @@ var SVGGraphics = function SVGGraphics() {
if (Array.isArray(bbox) && bbox.length === 4) {
var width = bbox[2] - bbox[0];
var height = bbox[3] - bbox[1];
var cliprect = document.createElementNS(NS, 'svg:rect');
var cliprect = this.svgFactory.createElement('svg:rect');
cliprect.setAttributeNS(null, 'x', bbox[0]);
cliprect.setAttributeNS(null, 'y', bbox[1]);
cliprect.setAttributeNS(null, 'width', pf(width));
@ -988,25 +990,21 @@ var SVGGraphics = function SVGGraphics() { @@ -988,25 +990,21 @@ var SVGGraphics = function SVGGraphics() {
}
},
paintFormXObjectEnd: function SVGGraphics_paintFormXObjectEnd() {},
_initialize: function SVGGraphics_initialize(viewport) {
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, 'preserveAspectRatio', 'none');
svg.setAttributeNS(null, 'viewBox', '0 0 ' + viewport.width + ' ' + viewport.height);
var definitions = document.createElementNS(NS, 'svg:defs');
_initialize: function _initialize(viewport) {
var svg = this.svgFactory.create(viewport.width, viewport.height);
var definitions = this.svgFactory.createElement('svg:defs');
svg.appendChild(definitions);
this.defs = definitions;
var rootGroup = document.createElementNS(NS, 'svg:g');
var rootGroup = this.svgFactory.createElement('svg:g');
rootGroup.setAttributeNS(null, 'transform', pm(viewport.transform));
svg.appendChild(rootGroup);
this.svg = rootGroup;
return svg;
},
_ensureClipGroup: function SVGGraphics_ensureClipGroup() {
if (!this.current.clipGroup) {
var clipGroup = document.createElementNS(NS, 'svg:g');
var clipGroup = this.svgFactory.createElement('svg:g');
clipGroup.setAttributeNS(null, 'clip-path', this.current.activeClipUrl);
this.svg.appendChild(clipGroup);
this.current.clipGroup = clipGroup;
@ -1015,7 +1013,7 @@ var SVGGraphics = function SVGGraphics() { @@ -1015,7 +1013,7 @@ var SVGGraphics = function SVGGraphics() {
},
_ensureTransformGroup: function SVGGraphics_ensureTransformGroup() {
if (!this.tgrp) {
this.tgrp = document.createElementNS(NS, 'svg:g');
this.tgrp = this.svgFactory.createElement('svg:g');
this.tgrp.setAttributeNS(null, 'transform', pm(this.transformMatrix));
if (this.current.activeClipUrl) {
this._ensureClipGroup().appendChild(this.tgrp);

4
lib/pdf.js

@ -14,8 +14,8 @@ @@ -14,8 +14,8 @@
*/
'use strict';
var pdfjsVersion = '1.9.544';
var pdfjsBuild = '437e9cb0';
var pdfjsVersion = '1.9.549';
var pdfjsBuild = '320779e6';
var pdfjsSharedUtil = require('./shared/util.js');
var pdfjsDisplayGlobal = require('./display/global.js');
var pdfjsDisplayAPI = require('./display/api.js');

4
lib/pdf.worker.js vendored

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
*/
'use strict';
var pdfjsVersion = '1.9.544';
var pdfjsBuild = '437e9cb0';
var pdfjsVersion = '1.9.549';
var pdfjsBuild = '320779e6';
var pdfjsCoreWorker = require('./core/worker.js');
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;

44
lib/test/unit/dom_utils_spec.js

@ -16,9 +16,53 @@ @@ -16,9 +16,53 @@
var _dom_utils = require('../../display/dom_utils');
var _util = require('../../shared/util');
var _global = require('../../display/global');
describe('dom_utils', function () {
describe('DOMSVGFactory', function () {
var svgFactory = void 0;
beforeAll(function (done) {
svgFactory = new _dom_utils.DOMSVGFactory();
done();
});
afterAll(function () {
svgFactory = null;
});
it('`create` should throw an error if the dimensions are invalid', function () {
expect(function () {
return svgFactory.create(-1, 0);
}).toThrow(new Error('Invalid SVG dimensions'));
expect(function () {
return svgFactory.create(0, -1);
}).toThrow(new Error('Invalid SVG dimensions'));
});
it('`create` should return an SVG element if the dimensions are valid', function () {
if ((0, _util.isNodeJS)()) {
pending('Document is not supported in Node.js.');
}
var svg = svgFactory.create(20, 40);
expect(svg instanceof SVGSVGElement).toBe(true);
expect(svg.getAttribute('version')).toBe('1.1');
expect(svg.getAttribute('width')).toBe('20px');
expect(svg.getAttribute('height')).toBe('40px');
expect(svg.getAttribute('preserveAspectRatio')).toBe('none');
expect(svg.getAttribute('viewBox')).toBe('0 0 20 40');
});
it('`createElement` should throw an error if the type is not a string', function () {
expect(function () {
return svgFactory.createElement(true);
}).toThrow(new Error('Invalid SVG element type'));
});
it('`createElement` should return an SVG element if the type is valid', function () {
if ((0, _util.isNodeJS)()) {
pending('Document is not supported in Node.js.');
}
var svg = svgFactory.createElement('svg:rect');
expect(svg instanceof SVGRectElement).toBe(true);
});
});
describe('getFilenameFromUrl', function () {
it('should get the filename from an absolute URL', function () {
var url = 'http://server.org/filename.pdf';

2
package.json

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

2
web/pdf_viewer.css

@ -250,6 +250,8 @@ @@ -250,6 +250,8 @@
.annotationLayer .squigglyAnnotation,
.annotationLayer .strikeoutAnnotation,
.annotationLayer .lineAnnotation svg line,
.annotationLayer .squareAnnotation svg rect,
.annotationLayer .circleAnnotation svg ellipse,
.annotationLayer .fileAttachmentAnnotation {
cursor: pointer;
}

Loading…
Cancel
Save