Browse Source

PDF.js version 1.3.116 - See mozilla/pdf.js@cfc0cc80eec8b61bd8ddb6abe0d8977b4ee39265

master v1.3.116
Pdf Bot 9 years ago
parent
commit
ebfe58704d
  1. 2
      bower.json
  2. 726
      build/pdf.combined.js
  3. 726
      build/pdf.js
  4. 4
      build/pdf.worker.js
  5. 2
      package.json
  6. 13
      web/pdf_viewer.js

2
bower.json

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

726
build/pdf.combined.js

@ -20,8 +20,8 @@ if (typeof PDFJS === 'undefined') {
(typeof window !== 'undefined' ? window : this).PDFJS = {}; (typeof window !== 'undefined' ? window : this).PDFJS = {};
} }
PDFJS.version = '1.3.114'; PDFJS.version = '1.3.116';
PDFJS.build = '9228e1f'; PDFJS.build = 'cfc0cc8';
(function pdfjsWrapper() { (function pdfjsWrapper() {
// Use strict in our context only - users might not want it // Use strict in our context only - users might not want it
@ -1811,341 +1811,531 @@ var CustomStyle = displayDOMUtils.CustomStyle;
var ANNOT_MIN_SIZE = 10; // px var ANNOT_MIN_SIZE = 10; // px
var AnnotationLayer = (function AnnotationLayerClosure() { /**
// TODO(mack): This dupes some of the logic in CanvasGraphics.setFont() * @typedef {Object} AnnotationElementParameters
function setTextStyles(element, item, fontObj) { * @property {Object} data
var style = element.style; * @property {PDFPage} page
style.fontSize = item.fontSize + 'px'; * @property {PageViewport} viewport
style.direction = item.fontDirection < 0 ? 'rtl': 'ltr'; * @property {IPDFLinkService} linkService
*/
if (!fontObj) { /**
return; * @class
} * @alias AnnotationElementFactory
*/
function AnnotationElementFactory() {}
AnnotationElementFactory.prototype =
/** @lends AnnotationElementFactory.prototype */ {
/**
* @param {AnnotationElementParameters} parameters
* @returns {AnnotationElement}
*/
create: function AnnotationElementFactory_create(parameters) {
var subtype = parameters.data.annotationType;
style.fontWeight = fontObj.black ? switch (subtype) {
(fontObj.bold ? 'bolder' : 'bold') : case AnnotationType.LINK:
(fontObj.bold ? 'bold' : 'normal'); return new LinkAnnotationElement(parameters);
style.fontStyle = fontObj.italic ? 'italic' : 'normal';
case AnnotationType.TEXT:
return new TextAnnotationElement(parameters);
var fontName = fontObj.loadedName; case AnnotationType.WIDGET:
var fontFamily = fontName ? '"' + fontName + '", ' : ''; return new WidgetAnnotationElement(parameters);
// Use a reasonable default font if the font doesn't specify a fallback
var fallbackName = fontObj.fallbackName || 'Helvetica, sans-serif'; default:
style.fontFamily = fontFamily + fallbackName; throw new Error('Unimplemented annotation type "' + subtype + '"');
}
} }
};
function getContainer(data, page, viewport) { /**
var container = document.createElement('section'); * @class
var width = data.rect[2] - data.rect[0]; * @alias AnnotationElement
var height = data.rect[3] - data.rect[1]; */
var AnnotationElement = (function AnnotationElementClosure() {
function AnnotationElement(parameters) {
this.data = parameters.data;
this.page = parameters.page;
this.viewport = parameters.viewport;
this.linkService = parameters.linkService;
container.setAttribute('data-annotation-id', data.id); this.container = this._createContainer();
}
data.rect = Util.normalizeRect([ AnnotationElement.prototype = /** @lends AnnotationElement.prototype */ {
data.rect[0], /**
page.view[3] - data.rect[1] + page.view[1], * Create an empty container for the annotation's HTML element.
data.rect[2], *
page.view[3] - data.rect[3] + page.view[1] * @private
]); * @memberof AnnotationElement
* @returns {HTMLSectionElement}
*/
_createContainer: function AnnotationElement_createContainer() {
var data = this.data, page = this.page, viewport = this.viewport;
var container = document.createElement('section');
var width = data.rect[2] - data.rect[0];
var height = data.rect[3] - data.rect[1];
container.setAttribute('data-annotation-id', data.id);
data.rect = Util.normalizeRect([
data.rect[0],
page.view[3] - data.rect[1] + page.view[1],
data.rect[2],
page.view[3] - data.rect[3] + page.view[1]
]);
CustomStyle.setProp('transform', container, CustomStyle.setProp('transform', container,
'matrix(' + viewport.transform.join(',') + ')'); 'matrix(' + viewport.transform.join(',') + ')');
CustomStyle.setProp('transformOrigin', container, CustomStyle.setProp('transformOrigin', container,
-data.rect[0] + 'px ' + -data.rect[1] + 'px'); -data.rect[0] + 'px ' + -data.rect[1] + 'px');
if (data.borderStyle.width > 0) { if (data.borderStyle.width > 0) {
container.style.borderWidth = data.borderStyle.width + 'px'; container.style.borderWidth = data.borderStyle.width + 'px';
if (data.borderStyle.style !== AnnotationBorderStyleType.UNDERLINE) { if (data.borderStyle.style !== AnnotationBorderStyleType.UNDERLINE) {
// Underline styles only have a bottom border, so we do not need // Underline styles only have a bottom border, so we do not need
// to adjust for all borders. This yields a similar result as // to adjust for all borders. This yields a similar result as
// Adobe Acrobat/Reader. // Adobe Acrobat/Reader.
width = width - 2 * data.borderStyle.width; width = width - 2 * data.borderStyle.width;
height = height - 2 * data.borderStyle.width; height = height - 2 * data.borderStyle.width;
} }
var horizontalRadius = data.borderStyle.horizontalCornerRadius; var horizontalRadius = data.borderStyle.horizontalCornerRadius;
var verticalRadius = data.borderStyle.verticalCornerRadius; var verticalRadius = data.borderStyle.verticalCornerRadius;
if (horizontalRadius > 0 || verticalRadius > 0) { if (horizontalRadius > 0 || verticalRadius > 0) {
var radius = horizontalRadius + 'px / ' + verticalRadius + 'px'; var radius = horizontalRadius + 'px / ' + verticalRadius + 'px';
CustomStyle.setProp('borderRadius', container, radius); CustomStyle.setProp('borderRadius', container, radius);
} }
switch (data.borderStyle.style) { switch (data.borderStyle.style) {
case AnnotationBorderStyleType.SOLID: case AnnotationBorderStyleType.SOLID:
container.style.borderStyle = 'solid'; container.style.borderStyle = 'solid';
break; break;
case AnnotationBorderStyleType.DASHED: case AnnotationBorderStyleType.DASHED:
container.style.borderStyle = 'dashed'; container.style.borderStyle = 'dashed';
break; break;
case AnnotationBorderStyleType.BEVELED: case AnnotationBorderStyleType.BEVELED:
warn('Unimplemented border style: beveled'); warn('Unimplemented border style: beveled');
break; break;
case AnnotationBorderStyleType.INSET: case AnnotationBorderStyleType.INSET:
warn('Unimplemented border style: inset'); warn('Unimplemented border style: inset');
break; break;
case AnnotationBorderStyleType.UNDERLINE: case AnnotationBorderStyleType.UNDERLINE:
container.style.borderBottomStyle = 'solid'; container.style.borderBottomStyle = 'solid';
break; break;
default: default:
break; break;
} }
if (data.color) { if (data.color) {
container.style.borderColor = container.style.borderColor =
Util.makeCssRgb(data.color[0] | 0, Util.makeCssRgb(data.color[0] | 0,
data.color[1] | 0, data.color[1] | 0,
data.color[2] | 0); data.color[2] | 0);
} else { } else {
// Transparent (invisible) border, so do not draw it at all. // Transparent (invisible) border, so do not draw it at all.
container.style.borderWidth = 0; container.style.borderWidth = 0;
}
} }
}
container.style.left = data.rect[0] + 'px'; container.style.left = data.rect[0] + 'px';
container.style.top = data.rect[1] + 'px'; container.style.top = data.rect[1] + 'px';
container.style.width = width + 'px';
container.style.height = height + 'px';
return container;
},
/**
* Render the annotation's HTML element in the empty container.
*
* @public
* @memberof AnnotationElement
*/
render: function AnnotationElement_render() {
throw new Error('Abstract method AnnotationElement.render called');
}
};
container.style.width = width + 'px'; return AnnotationElement;
container.style.height = height + 'px'; })();
return container; /**
* @class
* @alias LinkAnnotationElement
*/
var LinkAnnotationElement = (function LinkAnnotationElementClosure() {
function LinkAnnotationElement(parameters) {
AnnotationElement.call(this, parameters);
} }
function getHtmlElementForTextWidgetAnnotation(item, page, viewport) { Util.inherit(LinkAnnotationElement, AnnotationElement, {
var container = getContainer(item, page, viewport); /**
* Render the link annotation's HTML element in the empty container.
*
* @public
* @memberof LinkAnnotationElement
* @returns {HTMLSectionElement}
*/
render: function LinkAnnotationElement_render() {
this.container.className = 'annotLink';
var content = document.createElement('div'); var link = document.createElement('a');
content.textContent = item.fieldValue; link.href = link.title = this.data.url || '';
var textAlignment = item.textAlignment;
content.style.textAlign = ['left', 'center', 'right'][textAlignment];
content.style.verticalAlign = 'middle';
content.style.display = 'table-cell';
var fontObj = item.fontRefName ? if (this.data.url && isExternalLinkTargetSet()) {
page.commonObjs.getData(item.fontRefName) : null; link.target = LinkTargetStringMap[PDFJS.externalLinkTarget];
setTextStyles(content, item, fontObj); }
container.appendChild(content); // Strip referrer from the URL.
if (this.data.url) {
link.rel = PDFJS.externalLinkRel;
}
return container; if (!this.data.url) {
} if (this.data.action) {
this._bindNamedAction(link, this.data.action);
} else {
this._bindLink(link, ('dest' in this.data) ? this.data.dest : null);
}
}
function getHtmlElementForTextAnnotation(item, page, viewport) { this.container.appendChild(link);
var rect = item.rect; return this.container;
},
// sanity check because of OOo-generated PDFs /**
if ((rect[3] - rect[1]) < ANNOT_MIN_SIZE) { * Bind internal links to the link element.
rect[3] = rect[1] + ANNOT_MIN_SIZE; *
} * @private
if ((rect[2] - rect[0]) < ANNOT_MIN_SIZE) { * @param {Object} link
rect[2] = rect[0] + (rect[3] - rect[1]); // make it square * @param {Object} destination
* @memberof LinkAnnotationElement
*/
_bindLink: function LinkAnnotationElement_bindLink(link, destination) {
var self = this;
link.href = this.linkService.getDestinationHash(destination);
link.onclick = function() {
if (destination) {
self.linkService.navigateTo(destination);
}
return false;
};
if (destination) {
link.className = 'internalLink';
}
},
/**
* Bind named actions to the link element.
*
* @private
* @param {Object} link
* @param {Object} action
* @memberof LinkAnnotationElement
*/
_bindNamedAction:
function LinkAnnotationElement_bindNamedAction(link, action) {
var self = this;
link.href = this.linkService.getAnchorUrl('');
link.onclick = function() {
self.linkService.executeNamedAction(action);
return false;
};
link.className = 'internalLink';
} }
});
var container = getContainer(item, page, viewport); return LinkAnnotationElement;
container.className = 'annotText'; })();
var image = document.createElement('img'); /**
image.style.height = container.style.height; * @class
image.style.width = container.style.width; * @alias TextAnnotationElement
var iconName = item.name; */
image.src = PDFJS.imageResourcesPath + 'annotation-' + var TextAnnotationElement = (function TextAnnotationElementClosure() {
iconName.toLowerCase() + '.svg'; function TextAnnotationElement(parameters) {
image.alt = '[{{type}} Annotation]'; AnnotationElement.call(this, parameters);
image.dataset.l10nId = 'text_annotation_type';
image.dataset.l10nArgs = JSON.stringify({type: iconName});
var contentWrapper = document.createElement('div'); this.pinned = false;
contentWrapper.className = 'annotTextContentWrapper'; }
contentWrapper.style.left = Math.floor(rect[2] - rect[0] + 5) + 'px';
contentWrapper.style.top = '-10px';
var content = document.createElement('div'); Util.inherit(TextAnnotationElement, AnnotationElement, {
content.className = 'annotTextContent'; /**
content.setAttribute('hidden', true); * Render the text annotation's HTML element in the empty container.
*
* @public
* @memberof TextAnnotationElement
* @returns {HTMLSectionElement}
*/
render: function TextAnnotationElement_render() {
var rect = this.data.rect, container = this.container;
var i, ii; // Sanity check because of OOo-generated PDFs.
if (item.hasBgColor && item.color) { if ((rect[3] - rect[1]) < ANNOT_MIN_SIZE) {
var color = item.color; rect[3] = rect[1] + ANNOT_MIN_SIZE;
}
if ((rect[2] - rect[0]) < ANNOT_MIN_SIZE) {
rect[2] = rect[0] + (rect[3] - rect[1]); // make it square
}
// Enlighten the color (70%) container.className = 'annotText';
var BACKGROUND_ENLIGHT = 0.7;
var r = BACKGROUND_ENLIGHT * (255 - color[0]) + color[0];
var g = BACKGROUND_ENLIGHT * (255 - color[1]) + color[1];
var b = BACKGROUND_ENLIGHT * (255 - color[2]) + color[2];
content.style.backgroundColor = Util.makeCssRgb(r | 0, g | 0, b | 0);
}
var title = document.createElement('h1'); var image = document.createElement('img');
var text = document.createElement('p'); image.style.height = container.style.height;
title.textContent = item.title; image.style.width = container.style.width;
var iconName = this.data.name;
image.src = PDFJS.imageResourcesPath + 'annotation-' +
iconName.toLowerCase() + '.svg';
image.alt = '[{{type}} Annotation]';
image.dataset.l10nId = 'text_annotation_type';
image.dataset.l10nArgs = JSON.stringify({type: iconName});
if (!item.content && !item.title) { var contentWrapper = document.createElement('div');
contentWrapper.className = 'annotTextContentWrapper';
contentWrapper.style.left = Math.floor(rect[2] - rect[0] + 5) + 'px';
contentWrapper.style.top = '-10px';
var content = this.content = document.createElement('div');
content.className = 'annotTextContent';
content.setAttribute('hidden', true); content.setAttribute('hidden', true);
} else {
var e = document.createElement('span');
var lines = item.content.split(/(?:\r\n?|\n)/);
for (i = 0, ii = lines.length; i < ii; ++i) {
var line = lines[i];
e.appendChild(document.createTextNode(line));
if (i < (ii - 1)) {
e.appendChild(document.createElement('br'));
}
}
text.appendChild(e);
var pinned = false; var i, ii;
if (this.data.hasBgColor && this.data.color) {
var color = this.data.color;
var showAnnotation = function showAnnotation(pin) { // Enlighten the color (70%).
if (pin) { var BACKGROUND_ENLIGHT = 0.7;
pinned = true; var r = BACKGROUND_ENLIGHT * (255 - color[0]) + color[0];
} var g = BACKGROUND_ENLIGHT * (255 - color[1]) + color[1];
if (content.hasAttribute('hidden')) { var b = BACKGROUND_ENLIGHT * (255 - color[2]) + color[2];
container.style.zIndex += 1; content.style.backgroundColor = Util.makeCssRgb(r | 0, g | 0, b | 0);
content.removeAttribute('hidden'); }
}
};
var hideAnnotation = function hideAnnotation(unpin) { var title = document.createElement('h1');
if (unpin) { var text = document.createElement('p');
pinned = false; title.textContent = this.data.title;
}
if (!content.hasAttribute('hidden') && !pinned) {
container.style.zIndex -= 1;
content.setAttribute('hidden', true);
}
};
var toggleAnnotation = function toggleAnnotation() { if (!this.data.content && !this.data.title) {
if (pinned) { content.setAttribute('hidden', true);
hideAnnotation(true); } else {
} else { var e = document.createElement('span');
showAnnotation(true); var lines = this.data.content.split(/(?:\r\n?|\n)/);
for (i = 0, ii = lines.length; i < ii; ++i) {
var line = lines[i];
e.appendChild(document.createTextNode(line));
if (i < (ii - 1)) {
e.appendChild(document.createElement('br'));
}
} }
}; text.appendChild(e);
image.addEventListener('click', function image_clickHandler() { image.addEventListener('click', this._toggle.bind(this));
toggleAnnotation(); image.addEventListener('mouseover', this._show.bind(this, false));
}, false); image.addEventListener('mouseout', this._hide.bind(this, false));
image.addEventListener('mouseover', function image_mouseOverHandler() { content.addEventListener('click', this._hide.bind(this, true));
showAnnotation(); }
}, false);
image.addEventListener('mouseout', function image_mouseOutHandler() {
hideAnnotation();
}, false);
content.addEventListener('click', function content_clickHandler() { content.appendChild(title);
hideAnnotation(true); content.appendChild(text);
}, false); contentWrapper.appendChild(content);
} container.appendChild(image);
container.appendChild(contentWrapper);
return container;
},
content.appendChild(title); /**
content.appendChild(text); * Toggle the visibility of the content box.
contentWrapper.appendChild(content); *
container.appendChild(image); * @private
container.appendChild(contentWrapper); * @memberof TextAnnotationElement
*/
_toggle: function TextAnnotationElement_toggle() {
if (this.pinned) {
this._hide(true);
} else {
this._show(true);
}
},
return container; /**
} * Show the content box.
*
* @private
* @param {boolean} pin
* @memberof TextAnnotationElement
*/
_show: function TextAnnotationElement_show(pin) {
if (pin) {
this.pinned = true;
}
if (this.content.hasAttribute('hidden')) {
this.container.style.zIndex += 1;
this.content.removeAttribute('hidden');
}
},
function getHtmlElementForLinkAnnotation(item, page, viewport, linkService) { /**
function bindLink(link, dest) { * Hide the content box.
link.href = linkService.getDestinationHash(dest); *
link.onclick = function annotationsLayerBuilderLinksOnclick() { * @private
if (dest) { * @param {boolean} unpin
linkService.navigateTo(dest); * @memberof TextAnnotationElement
} */
return false; _hide: function TextAnnotationElement_hide(unpin) {
}; if (unpin) {
if (dest) { this.pinned = false;
link.className = 'internalLink'; }
if (!this.content.hasAttribute('hidden') && !this.pinned) {
this.container.style.zIndex -= 1;
this.content.setAttribute('hidden', true);
} }
} }
});
function bindNamedAction(link, action) { return TextAnnotationElement;
link.href = linkService.getAnchorUrl(''); })();
link.onclick = function annotationsLayerBuilderNamedActionOnClick() {
linkService.executeNamedAction(action);
return false;
};
link.className = 'internalLink';
}
var container = getContainer(item, page, viewport); /**
container.className = 'annotLink'; * @class
* @alias WidgetAnnotationElement
*/
var WidgetAnnotationElement = (function WidgetAnnotationElementClosure() {
function WidgetAnnotationElement(parameters) {
AnnotationElement.call(this, parameters);
}
var link = document.createElement('a'); Util.inherit(WidgetAnnotationElement, AnnotationElement, {
link.href = link.title = item.url || ''; /**
* Render the widget annotation's HTML element in the empty container.
*
* @public
* @memberof WidgetAnnotationElement
* @returns {HTMLSectionElement}
*/
render: function WidgetAnnotationElement_render() {
var content = document.createElement('div');
content.textContent = this.data.fieldValue;
var textAlignment = this.data.textAlignment;
content.style.textAlign = ['left', 'center', 'right'][textAlignment];
content.style.verticalAlign = 'middle';
content.style.display = 'table-cell';
if (item.url && isExternalLinkTargetSet()) { var font = (this.data.fontRefName ?
link.target = LinkTargetStringMap[PDFJS.externalLinkTarget]; this.page.commonObjs.getData(this.data.fontRefName) : null);
} this._setTextStyle(content, font);
// Strip referrer this.container.appendChild(content);
if (item.url) { return this.container;
link.rel = PDFJS.externalLinkRel; },
}
if (!item.url) { /**
if (item.action) { * Apply text styles to the text in the element.
bindNamedAction(link, item.action); *
} else { * @private
bindLink(link, ('dest' in item) ? item.dest : null); * @param {HTMLDivElement} element
* @param {Object} font
* @memberof WidgetAnnotationElement
*/
_setTextStyle:
function WidgetAnnotationElement_setTextStyle(element, font) {
// TODO: This duplicates some of the logic in CanvasGraphics.setFont().
var style = element.style;
style.fontSize = this.data.fontSize + 'px';
style.direction = (this.data.fontDirection < 0 ? 'rtl': 'ltr');
if (!font) {
return;
} }
style.fontWeight = (font.black ?
(font.bold ? '900' : 'bold') :
(font.bold ? 'bold' : 'normal'));
style.fontStyle = (font.italic ? 'italic' : 'normal');
// Use a reasonable default font if the font doesn't specify a fallback.
var fontFamily = font.loadedName ? '"' + font.loadedName + '", ' : '';
var fallbackName = font.fallbackName || 'Helvetica, sans-serif';
style.fontFamily = fontFamily + fallbackName;
} }
});
container.appendChild(link); return WidgetAnnotationElement;
})();
return container; /**
} * @typedef {Object} AnnotationLayerParameters
* @property {PageViewport} viewport
* @property {HTMLDivElement} div
* @property {Array} annotations
* @property {PDFPage} page
* @property {IPDFLinkService} linkService
*/
function getHtmlElement(data, page, viewport, linkService) { /**
switch (data.annotationType) { * @class
case AnnotationType.WIDGET: * @alias AnnotationLayer
return getHtmlElementForTextWidgetAnnotation(data, page, viewport); */
case AnnotationType.TEXT: var AnnotationLayer = (function AnnotationLayerClosure() {
return getHtmlElementForTextAnnotation(data, page, viewport); return {
case AnnotationType.LINK: /**
return getHtmlElementForLinkAnnotation(data, page, viewport, * Render a new annotation layer with all annotation elements.
linkService); *
default: * @public
throw new Error('Unsupported annotationType: ' + data.annotationType); * @param {AnnotationLayerParameters} parameters
} * @memberof AnnotationLayer
} */
render: function AnnotationLayer_render(parameters) {
var annotationElementFactory = new AnnotationElementFactory();
function render(viewport, div, annotations, page, linkService) { for (var i = 0, ii = parameters.annotations.length; i < ii; i++) {
for (var i = 0, ii = annotations.length; i < ii; i++) { var data = parameters.annotations[i];
var data = annotations[i]; if (!data || !data.hasHtml) {
if (!data || !data.hasHtml) { continue;
continue; }
}
var element = getHtmlElement(data, page, viewport, linkService); var properties = {
div.appendChild(element); data: data,
} page: parameters.page,
} viewport: parameters.viewport,
linkService: parameters.linkService
};
var element = annotationElementFactory.create(properties);
parameters.div.appendChild(element.render());
}
},
function update(viewport, div, annotations) { /**
for (var i = 0, ii = annotations.length; i < ii; i++) { * Update the annotation elements on existing annotation layer.
var data = annotations[i]; *
var element = div.querySelector( * @public
'[data-annotation-id="' + data.id + '"]'); * @param {AnnotationLayerParameters} parameters
if (element) { * @memberof AnnotationLayer
CustomStyle.setProp('transform', element, */
'matrix(' + viewport.transform.join(',') + ')'); update: function AnnotationLayer_update(parameters) {
for (var i = 0, ii = parameters.annotations.length; i < ii; i++) {
var data = parameters.annotations[i];
var element = parameters.div.querySelector(
'[data-annotation-id="' + data.id + '"]');
if (element) {
CustomStyle.setProp('transform', element,
'matrix(' + parameters.viewport.transform.join(',') + ')');
}
} }
parameters.div.removeAttribute('hidden');
} }
div.removeAttribute('hidden');
}
return {
render: render,
update: update
}; };
})(); })();
PDFJS.AnnotationLayer = AnnotationLayer; PDFJS.AnnotationLayer = AnnotationLayer;
exports.AnnotationLayer = AnnotationLayer; exports.AnnotationLayer = AnnotationLayer;

726
build/pdf.js

@ -20,8 +20,8 @@ if (typeof PDFJS === 'undefined') {
(typeof window !== 'undefined' ? window : this).PDFJS = {}; (typeof window !== 'undefined' ? window : this).PDFJS = {};
} }
PDFJS.version = '1.3.114'; PDFJS.version = '1.3.116';
PDFJS.build = '9228e1f'; PDFJS.build = 'cfc0cc8';
(function pdfjsWrapper() { (function pdfjsWrapper() {
// Use strict in our context only - users might not want it // Use strict in our context only - users might not want it
@ -1811,341 +1811,531 @@ var CustomStyle = displayDOMUtils.CustomStyle;
var ANNOT_MIN_SIZE = 10; // px var ANNOT_MIN_SIZE = 10; // px
var AnnotationLayer = (function AnnotationLayerClosure() { /**
// TODO(mack): This dupes some of the logic in CanvasGraphics.setFont() * @typedef {Object} AnnotationElementParameters
function setTextStyles(element, item, fontObj) { * @property {Object} data
var style = element.style; * @property {PDFPage} page
style.fontSize = item.fontSize + 'px'; * @property {PageViewport} viewport
style.direction = item.fontDirection < 0 ? 'rtl': 'ltr'; * @property {IPDFLinkService} linkService
*/
if (!fontObj) { /**
return; * @class
} * @alias AnnotationElementFactory
*/
function AnnotationElementFactory() {}
AnnotationElementFactory.prototype =
/** @lends AnnotationElementFactory.prototype */ {
/**
* @param {AnnotationElementParameters} parameters
* @returns {AnnotationElement}
*/
create: function AnnotationElementFactory_create(parameters) {
var subtype = parameters.data.annotationType;
switch (subtype) {
case AnnotationType.LINK:
return new LinkAnnotationElement(parameters);
case AnnotationType.TEXT:
return new TextAnnotationElement(parameters);
style.fontWeight = fontObj.black ? case AnnotationType.WIDGET:
(fontObj.bold ? 'bolder' : 'bold') : return new WidgetAnnotationElement(parameters);
(fontObj.bold ? 'bold' : 'normal');
style.fontStyle = fontObj.italic ? 'italic' : 'normal';
var fontName = fontObj.loadedName; default:
var fontFamily = fontName ? '"' + fontName + '", ' : ''; throw new Error('Unimplemented annotation type "' + subtype + '"');
// Use a reasonable default font if the font doesn't specify a fallback }
var fallbackName = fontObj.fallbackName || 'Helvetica, sans-serif';
style.fontFamily = fontFamily + fallbackName;
} }
};
function getContainer(data, page, viewport) { /**
var container = document.createElement('section'); * @class
var width = data.rect[2] - data.rect[0]; * @alias AnnotationElement
var height = data.rect[3] - data.rect[1]; */
var AnnotationElement = (function AnnotationElementClosure() {
function AnnotationElement(parameters) {
this.data = parameters.data;
this.page = parameters.page;
this.viewport = parameters.viewport;
this.linkService = parameters.linkService;
container.setAttribute('data-annotation-id', data.id); this.container = this._createContainer();
}
data.rect = Util.normalizeRect([ AnnotationElement.prototype = /** @lends AnnotationElement.prototype */ {
data.rect[0], /**
page.view[3] - data.rect[1] + page.view[1], * Create an empty container for the annotation's HTML element.
data.rect[2], *
page.view[3] - data.rect[3] + page.view[1] * @private
]); * @memberof AnnotationElement
* @returns {HTMLSectionElement}
*/
_createContainer: function AnnotationElement_createContainer() {
var data = this.data, page = this.page, viewport = this.viewport;
var container = document.createElement('section');
var width = data.rect[2] - data.rect[0];
var height = data.rect[3] - data.rect[1];
container.setAttribute('data-annotation-id', data.id);
data.rect = Util.normalizeRect([
data.rect[0],
page.view[3] - data.rect[1] + page.view[1],
data.rect[2],
page.view[3] - data.rect[3] + page.view[1]
]);
CustomStyle.setProp('transform', container, CustomStyle.setProp('transform', container,
'matrix(' + viewport.transform.join(',') + ')'); 'matrix(' + viewport.transform.join(',') + ')');
CustomStyle.setProp('transformOrigin', container, CustomStyle.setProp('transformOrigin', container,
-data.rect[0] + 'px ' + -data.rect[1] + 'px'); -data.rect[0] + 'px ' + -data.rect[1] + 'px');
if (data.borderStyle.width > 0) {
container.style.borderWidth = data.borderStyle.width + 'px';
if (data.borderStyle.style !== AnnotationBorderStyleType.UNDERLINE) {
// Underline styles only have a bottom border, so we do not need
// to adjust for all borders. This yields a similar result as
// Adobe Acrobat/Reader.
width = width - 2 * data.borderStyle.width;
height = height - 2 * data.borderStyle.width;
}
if (data.borderStyle.width > 0) { var horizontalRadius = data.borderStyle.horizontalCornerRadius;
container.style.borderWidth = data.borderStyle.width + 'px'; var verticalRadius = data.borderStyle.verticalCornerRadius;
if (data.borderStyle.style !== AnnotationBorderStyleType.UNDERLINE) { if (horizontalRadius > 0 || verticalRadius > 0) {
// Underline styles only have a bottom border, so we do not need var radius = horizontalRadius + 'px / ' + verticalRadius + 'px';
// to adjust for all borders. This yields a similar result as CustomStyle.setProp('borderRadius', container, radius);
// Adobe Acrobat/Reader. }
width = width - 2 * data.borderStyle.width;
height = height - 2 * data.borderStyle.width;
}
var horizontalRadius = data.borderStyle.horizontalCornerRadius; switch (data.borderStyle.style) {
var verticalRadius = data.borderStyle.verticalCornerRadius; case AnnotationBorderStyleType.SOLID:
if (horizontalRadius > 0 || verticalRadius > 0) { container.style.borderStyle = 'solid';
var radius = horizontalRadius + 'px / ' + verticalRadius + 'px'; break;
CustomStyle.setProp('borderRadius', container, radius);
}
switch (data.borderStyle.style) { case AnnotationBorderStyleType.DASHED:
case AnnotationBorderStyleType.SOLID: container.style.borderStyle = 'dashed';
container.style.borderStyle = 'solid'; break;
break;
case AnnotationBorderStyleType.DASHED: case AnnotationBorderStyleType.BEVELED:
container.style.borderStyle = 'dashed'; warn('Unimplemented border style: beveled');
break; break;
case AnnotationBorderStyleType.BEVELED: case AnnotationBorderStyleType.INSET:
warn('Unimplemented border style: beveled'); warn('Unimplemented border style: inset');
break; break;
case AnnotationBorderStyleType.INSET: case AnnotationBorderStyleType.UNDERLINE:
warn('Unimplemented border style: inset'); container.style.borderBottomStyle = 'solid';
break; break;
case AnnotationBorderStyleType.UNDERLINE: default:
container.style.borderBottomStyle = 'solid'; break;
break; }
default: if (data.color) {
break; container.style.borderColor =
Util.makeCssRgb(data.color[0] | 0,
data.color[1] | 0,
data.color[2] | 0);
} else {
// Transparent (invisible) border, so do not draw it at all.
container.style.borderWidth = 0;
}
} }
if (data.color) { container.style.left = data.rect[0] + 'px';
container.style.borderColor = container.style.top = data.rect[1] + 'px';
Util.makeCssRgb(data.color[0] | 0,
data.color[1] | 0,
data.color[2] | 0);
} else {
// Transparent (invisible) border, so do not draw it at all.
container.style.borderWidth = 0;
}
}
container.style.left = data.rect[0] + 'px'; container.style.width = width + 'px';
container.style.top = data.rect[1] + 'px'; container.style.height = height + 'px';
container.style.width = width + 'px'; return container;
container.style.height = height + 'px'; },
return container; /**
* Render the annotation's HTML element in the empty container.
*
* @public
* @memberof AnnotationElement
*/
render: function AnnotationElement_render() {
throw new Error('Abstract method AnnotationElement.render called');
}
};
return AnnotationElement;
})();
/**
* @class
* @alias LinkAnnotationElement
*/
var LinkAnnotationElement = (function LinkAnnotationElementClosure() {
function LinkAnnotationElement(parameters) {
AnnotationElement.call(this, parameters);
} }
function getHtmlElementForTextWidgetAnnotation(item, page, viewport) { Util.inherit(LinkAnnotationElement, AnnotationElement, {
var container = getContainer(item, page, viewport); /**
* Render the link annotation's HTML element in the empty container.
*
* @public
* @memberof LinkAnnotationElement
* @returns {HTMLSectionElement}
*/
render: function LinkAnnotationElement_render() {
this.container.className = 'annotLink';
var link = document.createElement('a');
link.href = link.title = this.data.url || '';
var content = document.createElement('div'); if (this.data.url && isExternalLinkTargetSet()) {
content.textContent = item.fieldValue; link.target = LinkTargetStringMap[PDFJS.externalLinkTarget];
var textAlignment = item.textAlignment; }
content.style.textAlign = ['left', 'center', 'right'][textAlignment];
content.style.verticalAlign = 'middle';
content.style.display = 'table-cell';
var fontObj = item.fontRefName ? // Strip referrer from the URL.
page.commonObjs.getData(item.fontRefName) : null; if (this.data.url) {
setTextStyles(content, item, fontObj); link.rel = PDFJS.externalLinkRel;
}
container.appendChild(content); if (!this.data.url) {
if (this.data.action) {
this._bindNamedAction(link, this.data.action);
} else {
this._bindLink(link, ('dest' in this.data) ? this.data.dest : null);
}
}
return container; this.container.appendChild(link);
} return this.container;
},
function getHtmlElementForTextAnnotation(item, page, viewport) { /**
var rect = item.rect; * Bind internal links to the link element.
*
* @private
* @param {Object} link
* @param {Object} destination
* @memberof LinkAnnotationElement
*/
_bindLink: function LinkAnnotationElement_bindLink(link, destination) {
var self = this;
// sanity check because of OOo-generated PDFs link.href = this.linkService.getDestinationHash(destination);
if ((rect[3] - rect[1]) < ANNOT_MIN_SIZE) { link.onclick = function() {
rect[3] = rect[1] + ANNOT_MIN_SIZE; if (destination) {
} self.linkService.navigateTo(destination);
if ((rect[2] - rect[0]) < ANNOT_MIN_SIZE) { }
rect[2] = rect[0] + (rect[3] - rect[1]); // make it square return false;
};
if (destination) {
link.className = 'internalLink';
}
},
/**
* Bind named actions to the link element.
*
* @private
* @param {Object} link
* @param {Object} action
* @memberof LinkAnnotationElement
*/
_bindNamedAction:
function LinkAnnotationElement_bindNamedAction(link, action) {
var self = this;
link.href = this.linkService.getAnchorUrl('');
link.onclick = function() {
self.linkService.executeNamedAction(action);
return false;
};
link.className = 'internalLink';
} }
});
var container = getContainer(item, page, viewport); return LinkAnnotationElement;
container.className = 'annotText'; })();
var image = document.createElement('img'); /**
image.style.height = container.style.height; * @class
image.style.width = container.style.width; * @alias TextAnnotationElement
var iconName = item.name; */
image.src = PDFJS.imageResourcesPath + 'annotation-' + var TextAnnotationElement = (function TextAnnotationElementClosure() {
iconName.toLowerCase() + '.svg'; function TextAnnotationElement(parameters) {
image.alt = '[{{type}} Annotation]'; AnnotationElement.call(this, parameters);
image.dataset.l10nId = 'text_annotation_type';
image.dataset.l10nArgs = JSON.stringify({type: iconName});
var contentWrapper = document.createElement('div'); this.pinned = false;
contentWrapper.className = 'annotTextContentWrapper'; }
contentWrapper.style.left = Math.floor(rect[2] - rect[0] + 5) + 'px';
contentWrapper.style.top = '-10px';
var content = document.createElement('div'); Util.inherit(TextAnnotationElement, AnnotationElement, {
content.className = 'annotTextContent'; /**
content.setAttribute('hidden', true); * Render the text annotation's HTML element in the empty container.
*
* @public
* @memberof TextAnnotationElement
* @returns {HTMLSectionElement}
*/
render: function TextAnnotationElement_render() {
var rect = this.data.rect, container = this.container;
var i, ii; // Sanity check because of OOo-generated PDFs.
if (item.hasBgColor && item.color) { if ((rect[3] - rect[1]) < ANNOT_MIN_SIZE) {
var color = item.color; rect[3] = rect[1] + ANNOT_MIN_SIZE;
}
if ((rect[2] - rect[0]) < ANNOT_MIN_SIZE) {
rect[2] = rect[0] + (rect[3] - rect[1]); // make it square
}
// Enlighten the color (70%) container.className = 'annotText';
var BACKGROUND_ENLIGHT = 0.7;
var r = BACKGROUND_ENLIGHT * (255 - color[0]) + color[0]; var image = document.createElement('img');
var g = BACKGROUND_ENLIGHT * (255 - color[1]) + color[1]; image.style.height = container.style.height;
var b = BACKGROUND_ENLIGHT * (255 - color[2]) + color[2]; image.style.width = container.style.width;
content.style.backgroundColor = Util.makeCssRgb(r | 0, g | 0, b | 0); var iconName = this.data.name;
} image.src = PDFJS.imageResourcesPath + 'annotation-' +
iconName.toLowerCase() + '.svg';
image.alt = '[{{type}} Annotation]';
image.dataset.l10nId = 'text_annotation_type';
image.dataset.l10nArgs = JSON.stringify({type: iconName});
var title = document.createElement('h1'); var contentWrapper = document.createElement('div');
var text = document.createElement('p'); contentWrapper.className = 'annotTextContentWrapper';
title.textContent = item.title; contentWrapper.style.left = Math.floor(rect[2] - rect[0] + 5) + 'px';
contentWrapper.style.top = '-10px';
if (!item.content && !item.title) { var content = this.content = document.createElement('div');
content.className = 'annotTextContent';
content.setAttribute('hidden', true); content.setAttribute('hidden', true);
} else {
var e = document.createElement('span');
var lines = item.content.split(/(?:\r\n?|\n)/);
for (i = 0, ii = lines.length; i < ii; ++i) {
var line = lines[i];
e.appendChild(document.createTextNode(line));
if (i < (ii - 1)) {
e.appendChild(document.createElement('br'));
}
}
text.appendChild(e);
var pinned = false; var i, ii;
if (this.data.hasBgColor && this.data.color) {
var color = this.data.color;
var showAnnotation = function showAnnotation(pin) { // Enlighten the color (70%).
if (pin) { var BACKGROUND_ENLIGHT = 0.7;
pinned = true; var r = BACKGROUND_ENLIGHT * (255 - color[0]) + color[0];
} var g = BACKGROUND_ENLIGHT * (255 - color[1]) + color[1];
if (content.hasAttribute('hidden')) { var b = BACKGROUND_ENLIGHT * (255 - color[2]) + color[2];
container.style.zIndex += 1; content.style.backgroundColor = Util.makeCssRgb(r | 0, g | 0, b | 0);
content.removeAttribute('hidden'); }
}
};
var hideAnnotation = function hideAnnotation(unpin) { var title = document.createElement('h1');
if (unpin) { var text = document.createElement('p');
pinned = false; title.textContent = this.data.title;
}
if (!content.hasAttribute('hidden') && !pinned) {
container.style.zIndex -= 1;
content.setAttribute('hidden', true);
}
};
var toggleAnnotation = function toggleAnnotation() { if (!this.data.content && !this.data.title) {
if (pinned) { content.setAttribute('hidden', true);
hideAnnotation(true); } else {
} else { var e = document.createElement('span');
showAnnotation(true); var lines = this.data.content.split(/(?:\r\n?|\n)/);
for (i = 0, ii = lines.length; i < ii; ++i) {
var line = lines[i];
e.appendChild(document.createTextNode(line));
if (i < (ii - 1)) {
e.appendChild(document.createElement('br'));
}
} }
}; text.appendChild(e);
image.addEventListener('click', function image_clickHandler() { image.addEventListener('click', this._toggle.bind(this));
toggleAnnotation(); image.addEventListener('mouseover', this._show.bind(this, false));
}, false); image.addEventListener('mouseout', this._hide.bind(this, false));
image.addEventListener('mouseover', function image_mouseOverHandler() { content.addEventListener('click', this._hide.bind(this, true));
showAnnotation(); }
}, false);
image.addEventListener('mouseout', function image_mouseOutHandler() {
hideAnnotation();
}, false);
content.addEventListener('click', function content_clickHandler() { content.appendChild(title);
hideAnnotation(true); content.appendChild(text);
}, false); contentWrapper.appendChild(content);
} container.appendChild(image);
container.appendChild(contentWrapper);
return container;
},
content.appendChild(title); /**
content.appendChild(text); * Toggle the visibility of the content box.
contentWrapper.appendChild(content); *
container.appendChild(image); * @private
container.appendChild(contentWrapper); * @memberof TextAnnotationElement
*/
_toggle: function TextAnnotationElement_toggle() {
if (this.pinned) {
this._hide(true);
} else {
this._show(true);
}
},
return container; /**
} * Show the content box.
*
* @private
* @param {boolean} pin
* @memberof TextAnnotationElement
*/
_show: function TextAnnotationElement_show(pin) {
if (pin) {
this.pinned = true;
}
if (this.content.hasAttribute('hidden')) {
this.container.style.zIndex += 1;
this.content.removeAttribute('hidden');
}
},
function getHtmlElementForLinkAnnotation(item, page, viewport, linkService) { /**
function bindLink(link, dest) { * Hide the content box.
link.href = linkService.getDestinationHash(dest); *
link.onclick = function annotationsLayerBuilderLinksOnclick() { * @private
if (dest) { * @param {boolean} unpin
linkService.navigateTo(dest); * @memberof TextAnnotationElement
} */
return false; _hide: function TextAnnotationElement_hide(unpin) {
}; if (unpin) {
if (dest) { this.pinned = false;
link.className = 'internalLink'; }
if (!this.content.hasAttribute('hidden') && !this.pinned) {
this.container.style.zIndex -= 1;
this.content.setAttribute('hidden', true);
} }
} }
});
function bindNamedAction(link, action) { return TextAnnotationElement;
link.href = linkService.getAnchorUrl(''); })();
link.onclick = function annotationsLayerBuilderNamedActionOnClick() {
linkService.executeNamedAction(action);
return false;
};
link.className = 'internalLink';
}
var container = getContainer(item, page, viewport); /**
container.className = 'annotLink'; * @class
* @alias WidgetAnnotationElement
*/
var WidgetAnnotationElement = (function WidgetAnnotationElementClosure() {
function WidgetAnnotationElement(parameters) {
AnnotationElement.call(this, parameters);
}
var link = document.createElement('a'); Util.inherit(WidgetAnnotationElement, AnnotationElement, {
link.href = link.title = item.url || ''; /**
* Render the widget annotation's HTML element in the empty container.
*
* @public
* @memberof WidgetAnnotationElement
* @returns {HTMLSectionElement}
*/
render: function WidgetAnnotationElement_render() {
var content = document.createElement('div');
content.textContent = this.data.fieldValue;
var textAlignment = this.data.textAlignment;
content.style.textAlign = ['left', 'center', 'right'][textAlignment];
content.style.verticalAlign = 'middle';
content.style.display = 'table-cell';
if (item.url && isExternalLinkTargetSet()) { var font = (this.data.fontRefName ?
link.target = LinkTargetStringMap[PDFJS.externalLinkTarget]; this.page.commonObjs.getData(this.data.fontRefName) : null);
} this._setTextStyle(content, font);
// Strip referrer this.container.appendChild(content);
if (item.url) { return this.container;
link.rel = PDFJS.externalLinkRel; },
}
if (!item.url) { /**
if (item.action) { * Apply text styles to the text in the element.
bindNamedAction(link, item.action); *
} else { * @private
bindLink(link, ('dest' in item) ? item.dest : null); * @param {HTMLDivElement} element
* @param {Object} font
* @memberof WidgetAnnotationElement
*/
_setTextStyle:
function WidgetAnnotationElement_setTextStyle(element, font) {
// TODO: This duplicates some of the logic in CanvasGraphics.setFont().
var style = element.style;
style.fontSize = this.data.fontSize + 'px';
style.direction = (this.data.fontDirection < 0 ? 'rtl': 'ltr');
if (!font) {
return;
} }
style.fontWeight = (font.black ?
(font.bold ? '900' : 'bold') :
(font.bold ? 'bold' : 'normal'));
style.fontStyle = (font.italic ? 'italic' : 'normal');
// Use a reasonable default font if the font doesn't specify a fallback.
var fontFamily = font.loadedName ? '"' + font.loadedName + '", ' : '';
var fallbackName = font.fallbackName || 'Helvetica, sans-serif';
style.fontFamily = fontFamily + fallbackName;
} }
});
container.appendChild(link); return WidgetAnnotationElement;
})();
return container; /**
} * @typedef {Object} AnnotationLayerParameters
* @property {PageViewport} viewport
* @property {HTMLDivElement} div
* @property {Array} annotations
* @property {PDFPage} page
* @property {IPDFLinkService} linkService
*/
function getHtmlElement(data, page, viewport, linkService) { /**
switch (data.annotationType) { * @class
case AnnotationType.WIDGET: * @alias AnnotationLayer
return getHtmlElementForTextWidgetAnnotation(data, page, viewport); */
case AnnotationType.TEXT: var AnnotationLayer = (function AnnotationLayerClosure() {
return getHtmlElementForTextAnnotation(data, page, viewport); return {
case AnnotationType.LINK: /**
return getHtmlElementForLinkAnnotation(data, page, viewport, * Render a new annotation layer with all annotation elements.
linkService); *
default: * @public
throw new Error('Unsupported annotationType: ' + data.annotationType); * @param {AnnotationLayerParameters} parameters
} * @memberof AnnotationLayer
} */
render: function AnnotationLayer_render(parameters) {
var annotationElementFactory = new AnnotationElementFactory();
function render(viewport, div, annotations, page, linkService) { for (var i = 0, ii = parameters.annotations.length; i < ii; i++) {
for (var i = 0, ii = annotations.length; i < ii; i++) { var data = parameters.annotations[i];
var data = annotations[i]; if (!data || !data.hasHtml) {
if (!data || !data.hasHtml) { continue;
continue; }
}
var element = getHtmlElement(data, page, viewport, linkService); var properties = {
div.appendChild(element); data: data,
} page: parameters.page,
} viewport: parameters.viewport,
linkService: parameters.linkService
};
var element = annotationElementFactory.create(properties);
parameters.div.appendChild(element.render());
}
},
function update(viewport, div, annotations) { /**
for (var i = 0, ii = annotations.length; i < ii; i++) { * Update the annotation elements on existing annotation layer.
var data = annotations[i]; *
var element = div.querySelector( * @public
'[data-annotation-id="' + data.id + '"]'); * @param {AnnotationLayerParameters} parameters
if (element) { * @memberof AnnotationLayer
CustomStyle.setProp('transform', element, */
'matrix(' + viewport.transform.join(',') + ')'); update: function AnnotationLayer_update(parameters) {
for (var i = 0, ii = parameters.annotations.length; i < ii; i++) {
var data = parameters.annotations[i];
var element = parameters.div.querySelector(
'[data-annotation-id="' + data.id + '"]');
if (element) {
CustomStyle.setProp('transform', element,
'matrix(' + parameters.viewport.transform.join(',') + ')');
}
} }
parameters.div.removeAttribute('hidden');
} }
div.removeAttribute('hidden');
}
return {
render: render,
update: update
}; };
})(); })();
PDFJS.AnnotationLayer = AnnotationLayer; PDFJS.AnnotationLayer = AnnotationLayer;
exports.AnnotationLayer = AnnotationLayer; exports.AnnotationLayer = AnnotationLayer;

4
build/pdf.worker.js vendored

@ -20,8 +20,8 @@ if (typeof PDFJS === 'undefined') {
(typeof window !== 'undefined' ? window : this).PDFJS = {}; (typeof window !== 'undefined' ? window : this).PDFJS = {};
} }
PDFJS.version = '1.3.114'; PDFJS.version = '1.3.116';
PDFJS.build = '9228e1f'; PDFJS.build = 'cfc0cc8';
(function pdfjsWrapper() { (function pdfjsWrapper() {
// Use strict in our context only - users might not want it // Use strict in our context only - users might not want it

2
package.json

@ -1,6 +1,6 @@
{ {
"name": "pdfjs-dist", "name": "pdfjs-dist",
"version": "1.3.114", "version": "1.3.116",
"description": "Generic build of Mozilla's PDF.js library.", "description": "Generic build of Mozilla's PDF.js library.",
"keywords": [ "keywords": [
"Mozilla", "Mozilla",

13
web/pdf_viewer.js

@ -1803,11 +1803,18 @@ var AnnotationLayerBuilder = (function AnnotationLayerBuilderClosure() {
this.pdfPage.getAnnotations(parameters).then(function (annotations) { this.pdfPage.getAnnotations(parameters).then(function (annotations) {
viewport = viewport.clone({ dontFlip: true }); viewport = viewport.clone({ dontFlip: true });
parameters = {
viewport: viewport,
div: self.div,
annotations: annotations,
page: self.pdfPage,
linkService: self.linkService
};
if (self.div) { if (self.div) {
// If an annotationLayer already exists, refresh its children's // If an annotationLayer already exists, refresh its children's
// transformation matrices. // transformation matrices.
PDFJS.AnnotationLayer.update(viewport, self.div, annotations); PDFJS.AnnotationLayer.update(parameters);
} else { } else {
// Create an annotation layer div and render the annotations // Create an annotation layer div and render the annotations
// if there is at least one annotation. // if there is at least one annotation.
@ -1818,9 +1825,9 @@ var AnnotationLayerBuilder = (function AnnotationLayerBuilderClosure() {
self.div = document.createElement('div'); self.div = document.createElement('div');
self.div.className = 'annotationLayer'; self.div.className = 'annotationLayer';
self.pageDiv.appendChild(self.div); self.pageDiv.appendChild(self.div);
parameters.div = self.div;
PDFJS.AnnotationLayer.render(viewport, self.div, annotations, PDFJS.AnnotationLayer.render(parameters);
self.pdfPage, self.linkService);
if (typeof mozL10n !== 'undefined') { if (typeof mozL10n !== 'undefined') {
mozL10n.translate(self.div); mozL10n.translate(self.div);
} }

Loading…
Cancel
Save