зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1732395 - Update pdf.js to version 2.11.298 r=pdfjs-reviewers,marco
Differential Revision: https://phabricator.services.mozilla.com/D126554
This commit is contained in:
Родитель
d084a1afae
Коммит
4547265146
|
@ -1,5 +1,5 @@
|
|||
This is the PDF.js project output, https://github.com/mozilla/pdf.js
|
||||
|
||||
Current extension version is: 2.11.283
|
||||
Current extension version is: 2.11.298
|
||||
|
||||
Taken from upstream commit: 638115885
|
||||
Taken from upstream commit: d370a281c
|
||||
|
|
|
@ -62,7 +62,12 @@ exports.DEFAULT_LINK_REL = DEFAULT_LINK_REL;
|
|||
const SVG_NS = "http://www.w3.org/2000/svg";
|
||||
const PixelsPerInch = {
|
||||
CSS: 96.0,
|
||||
PDF: 72.0
|
||||
PDF: 72.0,
|
||||
|
||||
get PDF_TO_CSS_UNITS() {
|
||||
return (0, _util.shadow)(this, "PDF_TO_CSS_UNITS", this.CSS / this.PDF);
|
||||
}
|
||||
|
||||
};
|
||||
exports.PixelsPerInch = PixelsPerInch;
|
||||
|
||||
|
@ -1907,7 +1912,7 @@ async function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
|
|||
|
||||
const workerId = await worker.messageHandler.sendWithPromise("GetDocRequest", {
|
||||
docId,
|
||||
apiVersion: '2.11.283',
|
||||
apiVersion: '2.11.298',
|
||||
source: {
|
||||
data: source.data,
|
||||
url: source.url,
|
||||
|
@ -3203,6 +3208,7 @@ class WorkerTransport {
|
|||
Promise.all(waitOn).then(() => {
|
||||
this.commonObjs.clear();
|
||||
this.fontLoader.clear();
|
||||
this._getFieldObjectsPromise = null;
|
||||
this._hasJSActionsPromise = null;
|
||||
|
||||
if (this._networkStream) {
|
||||
|
@ -3607,7 +3613,7 @@ class WorkerTransport {
|
|||
}
|
||||
|
||||
getFieldObjects() {
|
||||
return this.messageHandler.sendWithPromise("GetFieldObjects", null);
|
||||
return this._getFieldObjectsPromise ||= this.messageHandler.sendWithPromise("GetFieldObjects", null);
|
||||
}
|
||||
|
||||
hasJSActions() {
|
||||
|
@ -3736,13 +3742,15 @@ class WorkerTransport {
|
|||
this.fontLoader.clear();
|
||||
}
|
||||
|
||||
this._getFieldObjectsPromise = null;
|
||||
this._hasJSActionsPromise = null;
|
||||
}
|
||||
|
||||
get loadingParams() {
|
||||
const params = this._params;
|
||||
return (0, _util.shadow)(this, "loadingParams", {
|
||||
disableAutoFetch: params.disableAutoFetch
|
||||
disableAutoFetch: params.disableAutoFetch,
|
||||
enableXfa: params.enableXfa
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -3988,9 +3996,9 @@ class InternalRenderTask {
|
|||
|
||||
}
|
||||
|
||||
const version = '2.11.283';
|
||||
const version = '2.11.298';
|
||||
exports.version = version;
|
||||
const build = '638115885';
|
||||
const build = 'd370a281c';
|
||||
exports.build = build;
|
||||
|
||||
/***/ }),
|
||||
|
@ -5163,7 +5171,7 @@ function getImageSmoothingEnabled(transform, interpolate) {
|
|||
|
||||
scale[0] = Math.fround(scale[0]);
|
||||
scale[1] = Math.fround(scale[1]);
|
||||
const actualScale = Math.fround((globalThis.devicePixelRatio || 1) * _display_utils.PixelsPerInch.CSS / _display_utils.PixelsPerInch.PDF);
|
||||
const actualScale = Math.fround((globalThis.devicePixelRatio || 1) * _display_utils.PixelsPerInch.PDF_TO_CSS_UNITS);
|
||||
|
||||
if (interpolate !== undefined) {
|
||||
return interpolate;
|
||||
|
@ -8605,6 +8613,7 @@ var _annotation_storage = __w_pdfjs_require__(9);
|
|||
var _scripting_utils = __w_pdfjs_require__(19);
|
||||
|
||||
const DEFAULT_TAB_INDEX = 1000;
|
||||
const GetElementsByNameSet = new WeakSet();
|
||||
|
||||
class AnnotationElementFactory {
|
||||
static create(parameters) {
|
||||
|
@ -8710,6 +8719,7 @@ class AnnotationElement {
|
|||
this.annotationStorage = parameters.annotationStorage;
|
||||
this.enableScripting = parameters.enableScripting;
|
||||
this.hasJSActions = parameters.hasJSActions;
|
||||
this._fieldObjects = parameters.fieldObjects;
|
||||
this._mouseState = parameters.mouseState;
|
||||
|
||||
if (isRenderable) {
|
||||
|
@ -8848,6 +8858,69 @@ class AnnotationElement {
|
|||
(0, _util.unreachable)("Abstract method `AnnotationElement.render` called");
|
||||
}
|
||||
|
||||
_getElementsByName(name, skipId = null) {
|
||||
const fields = [];
|
||||
|
||||
if (this._fieldObjects) {
|
||||
const fieldObj = this._fieldObjects[name];
|
||||
|
||||
if (fieldObj) {
|
||||
for (const {
|
||||
page,
|
||||
id,
|
||||
exportValues
|
||||
} of fieldObj) {
|
||||
if (page === -1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (id === skipId) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const exportValue = typeof exportValues === "string" ? exportValues : null;
|
||||
const domElement = document.getElementById(id);
|
||||
|
||||
if (domElement && !GetElementsByNameSet.has(domElement)) {
|
||||
(0, _util.warn)(`_getElementsByName - element not allowed: ${id}`);
|
||||
continue;
|
||||
}
|
||||
|
||||
fields.push({
|
||||
id,
|
||||
exportValue,
|
||||
domElement
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return fields;
|
||||
}
|
||||
|
||||
for (const domElement of document.getElementsByName(name)) {
|
||||
const {
|
||||
id,
|
||||
exportValue
|
||||
} = domElement;
|
||||
|
||||
if (id === skipId) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!GetElementsByNameSet.has(domElement)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
fields.push({
|
||||
id,
|
||||
exportValue,
|
||||
domElement
|
||||
});
|
||||
}
|
||||
|
||||
return fields;
|
||||
}
|
||||
|
||||
static get platform() {
|
||||
const platform = typeof navigator !== "undefined" ? navigator.platform : "";
|
||||
return (0, _util.shadow)(this, "platform", {
|
||||
|
@ -9136,13 +9209,14 @@ class TextWidgetAnnotationElement extends WidgetAnnotationElement {
|
|||
setPropertyOnSiblings(base, key, value, keyInStorage) {
|
||||
const storage = this.annotationStorage;
|
||||
|
||||
for (const element of document.getElementsByName(base.name)) {
|
||||
if (element !== base) {
|
||||
element[key] = value;
|
||||
const data = Object.create(null);
|
||||
data[keyInStorage] = value;
|
||||
storage.setValue(element.getAttribute("id"), data);
|
||||
for (const element of this._getElementsByName(base.name, base.id)) {
|
||||
if (element.domElement) {
|
||||
element.domElement[key] = value;
|
||||
}
|
||||
|
||||
storage.setValue(element.id, {
|
||||
[keyInStorage]: value
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9174,6 +9248,9 @@ class TextWidgetAnnotationElement extends WidgetAnnotationElement {
|
|||
element.setAttribute("value", textContent);
|
||||
}
|
||||
|
||||
GetElementsByNameSet.add(element);
|
||||
element.disabled = this.data.readOnly;
|
||||
element.name = this.data.fieldName;
|
||||
element.tabIndex = DEFAULT_TAB_INDEX;
|
||||
elementData.userValue = textContent;
|
||||
element.setAttribute("id", id);
|
||||
|
@ -9331,9 +9408,6 @@ class TextWidgetAnnotationElement extends WidgetAnnotationElement {
|
|||
element.addEventListener("blur", blurListener);
|
||||
}
|
||||
|
||||
element.disabled = this.data.readOnly;
|
||||
element.name = this.data.fieldName;
|
||||
|
||||
if (this.data.maxLen !== null) {
|
||||
element.maxLength = this.data.maxLen;
|
||||
}
|
||||
|
@ -9402,6 +9476,7 @@ class CheckboxWidgetAnnotationElement extends WidgetAnnotationElement {
|
|||
|
||||
this.container.className = "buttonWidgetAnnotation checkBox";
|
||||
const element = document.createElement("input");
|
||||
GetElementsByNameSet.add(element);
|
||||
element.disabled = data.readOnly;
|
||||
element.type = "checkbox";
|
||||
element.name = data.fieldName;
|
||||
|
@ -9413,17 +9488,22 @@ class CheckboxWidgetAnnotationElement extends WidgetAnnotationElement {
|
|||
element.setAttribute("id", id);
|
||||
element.setAttribute("exportValue", data.exportValue);
|
||||
element.tabIndex = DEFAULT_TAB_INDEX;
|
||||
element.addEventListener("change", function (event) {
|
||||
const name = event.target.name;
|
||||
const checked = event.target.checked;
|
||||
element.addEventListener("change", event => {
|
||||
const {
|
||||
name,
|
||||
checked
|
||||
} = event.target;
|
||||
|
||||
for (const checkbox of document.getElementsByName(name)) {
|
||||
if (checkbox !== event.target) {
|
||||
checkbox.checked = checked && checkbox.getAttribute("exportValue") === data.exportValue;
|
||||
storage.setValue(checkbox.parentNode.getAttribute("data-annotation-id"), {
|
||||
value: false
|
||||
});
|
||||
for (const checkbox of this._getElementsByName(name, id)) {
|
||||
const curChecked = checked && checkbox.exportValue === data.exportValue;
|
||||
|
||||
if (checkbox.domElement) {
|
||||
checkbox.domElement.checked = curChecked;
|
||||
}
|
||||
|
||||
storage.setValue(checkbox.id, {
|
||||
value: curChecked
|
||||
});
|
||||
}
|
||||
|
||||
storage.setValue(id, {
|
||||
|
@ -9479,6 +9559,7 @@ class RadioButtonWidgetAnnotationElement extends WidgetAnnotationElement {
|
|||
}
|
||||
|
||||
const element = document.createElement("input");
|
||||
GetElementsByNameSet.add(element);
|
||||
element.disabled = data.readOnly;
|
||||
element.type = "radio";
|
||||
element.name = data.fieldName;
|
||||
|
@ -9489,21 +9570,20 @@ class RadioButtonWidgetAnnotationElement extends WidgetAnnotationElement {
|
|||
|
||||
element.setAttribute("id", id);
|
||||
element.tabIndex = DEFAULT_TAB_INDEX;
|
||||
element.addEventListener("change", function (event) {
|
||||
element.addEventListener("change", event => {
|
||||
const {
|
||||
target
|
||||
} = event;
|
||||
name,
|
||||
checked
|
||||
} = event.target;
|
||||
|
||||
for (const radio of document.getElementsByName(target.name)) {
|
||||
if (radio !== target) {
|
||||
storage.setValue(radio.getAttribute("id"), {
|
||||
value: false
|
||||
});
|
||||
}
|
||||
for (const radio of this._getElementsByName(name, id)) {
|
||||
storage.setValue(radio.id, {
|
||||
value: false
|
||||
});
|
||||
}
|
||||
|
||||
storage.setValue(id, {
|
||||
value: target.checked
|
||||
value: checked
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -9511,18 +9591,21 @@ class RadioButtonWidgetAnnotationElement extends WidgetAnnotationElement {
|
|||
const pdfButtonValue = data.buttonValue;
|
||||
element.addEventListener("updatefromsandbox", jsEvent => {
|
||||
const actions = {
|
||||
value(event) {
|
||||
value: event => {
|
||||
const checked = pdfButtonValue === event.detail.value;
|
||||
|
||||
for (const radio of document.getElementsByName(event.target.name)) {
|
||||
const radioId = radio.getAttribute("id");
|
||||
radio.checked = radioId === id && checked;
|
||||
storage.setValue(radioId, {
|
||||
value: radio.checked
|
||||
for (const radio of this._getElementsByName(event.target.name)) {
|
||||
const curChecked = checked && radio.id === id;
|
||||
|
||||
if (radio.domElement) {
|
||||
radio.domElement.checked = curChecked;
|
||||
}
|
||||
|
||||
storage.setValue(radio.id, {
|
||||
value: curChecked
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
this._dispatchEventFromSandbox(actions, jsEvent);
|
||||
|
@ -9575,6 +9658,7 @@ class ChoiceWidgetAnnotationElement extends WidgetAnnotationElement {
|
|||
|
||||
const fontSizeStyle = `calc(${fontSize}px * var(--zoom-factor))`;
|
||||
const selectElement = document.createElement("select");
|
||||
GetElementsByNameSet.add(selectElement);
|
||||
selectElement.disabled = this.data.readOnly;
|
||||
selectElement.name = this.data.fieldName;
|
||||
selectElement.setAttribute("id", id);
|
||||
|
@ -10369,6 +10453,7 @@ class AnnotationLayer {
|
|||
annotationStorage: parameters.annotationStorage || new _annotation_storage.AnnotationStorage(),
|
||||
enableScripting: parameters.enableScripting,
|
||||
hasJSActions: parameters.hasJSActions,
|
||||
fieldObjects: parameters.fieldObjects,
|
||||
mouseState: parameters.mouseState || {
|
||||
isDown: false
|
||||
}
|
||||
|
@ -11782,8 +11867,8 @@ var _svg = __w_pdfjs_require__(21);
|
|||
|
||||
var _xfa_layer = __w_pdfjs_require__(22);
|
||||
|
||||
const pdfjsVersion = '2.11.283';
|
||||
const pdfjsBuild = '638115885';
|
||||
const pdfjsVersion = '2.11.298';
|
||||
const pdfjsBuild = 'd370a281c';
|
||||
;
|
||||
})();
|
||||
|
||||
|
|
|
@ -4932,8 +4932,8 @@ Object.defineProperty(exports, "initSandbox", ({
|
|||
|
||||
var _initialization = __w_pdfjs_require__(1);
|
||||
|
||||
const pdfjsVersion = '2.11.283';
|
||||
const pdfjsBuild = '638115885';
|
||||
const pdfjsVersion = '2.11.298';
|
||||
const pdfjsBuild = 'd370a281c';
|
||||
})();
|
||||
|
||||
/******/ return __webpack_exports__;
|
||||
|
|
|
@ -125,7 +125,7 @@ class WorkerMessageHandler {
|
|||
const WorkerTasks = [];
|
||||
const verbosity = (0, _util.getVerbosityLevel)();
|
||||
const apiVersion = docParams.apiVersion;
|
||||
const workerVersion = '2.11.283';
|
||||
const workerVersion = '2.11.298';
|
||||
|
||||
if (apiVersion !== workerVersion) {
|
||||
throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
|
||||
|
@ -517,20 +517,20 @@ class WorkerMessageHandler {
|
|||
}
|
||||
|
||||
const xfa = acroForm instanceof _primitives.Dict && acroForm.get("XFA") || null;
|
||||
let xfaDatasets = null;
|
||||
let hasDatasets = false;
|
||||
let xfaDatasetsRef = null;
|
||||
let hasXfaDatasetsEntry = false;
|
||||
|
||||
if (Array.isArray(xfa)) {
|
||||
for (let i = 0, ii = xfa.length; i < ii; i += 2) {
|
||||
if (xfa[i] === "datasets") {
|
||||
xfaDatasets = xfa[i + 1];
|
||||
xfaDatasetsRef = xfa[i + 1];
|
||||
acroFormRef = null;
|
||||
hasDatasets = true;
|
||||
hasXfaDatasetsEntry = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (xfaDatasets === null) {
|
||||
xfaDatasets = xref.getNewRef();
|
||||
if (xfaDatasetsRef === null) {
|
||||
xfaDatasetsRef = xref.getNewRef();
|
||||
}
|
||||
} else if (xfa) {
|
||||
acroFormRef = null;
|
||||
|
@ -569,8 +569,9 @@ class WorkerMessageHandler {
|
|||
xrefInfo: newXrefInfo,
|
||||
newRefs,
|
||||
xref,
|
||||
datasetsRef: xfaDatasets,
|
||||
hasDatasets,
|
||||
hasXfa: !!xfa,
|
||||
xfaDatasetsRef,
|
||||
hasXfaDatasetsEntry,
|
||||
acroFormRef,
|
||||
acroForm,
|
||||
xfaData
|
||||
|
@ -43696,8 +43697,8 @@ function writeXFADataForAcroform(str, newRefs) {
|
|||
|
||||
function updateXFA({
|
||||
xfaData,
|
||||
datasetsRef,
|
||||
hasDatasets,
|
||||
xfaDatasetsRef,
|
||||
hasXfaDatasetsEntry,
|
||||
acroFormRef,
|
||||
acroForm,
|
||||
newRefs,
|
||||
|
@ -43708,7 +43709,7 @@ function updateXFA({
|
|||
return;
|
||||
}
|
||||
|
||||
if (!hasDatasets) {
|
||||
if (!hasXfaDatasetsEntry) {
|
||||
if (!acroFormRef) {
|
||||
(0, _util.warn)("XFA - Cannot save it");
|
||||
return;
|
||||
|
@ -43717,7 +43718,7 @@ function updateXFA({
|
|||
const oldXfa = acroForm.get("XFA");
|
||||
const newXfa = oldXfa.slice();
|
||||
newXfa.splice(2, 0, "datasets");
|
||||
newXfa.splice(3, 0, datasetsRef);
|
||||
newXfa.splice(3, 0, xfaDatasetsRef);
|
||||
acroForm.set("XFA", newXfa);
|
||||
const encrypt = xref.encrypt;
|
||||
let transform = null;
|
||||
|
@ -43737,20 +43738,20 @@ function updateXFA({
|
|||
}
|
||||
|
||||
if (xfaData === null) {
|
||||
const datasets = xref.fetchIfRef(datasetsRef);
|
||||
const datasets = xref.fetchIfRef(xfaDatasetsRef);
|
||||
xfaData = writeXFADataForAcroform(datasets.getString(), newRefs);
|
||||
}
|
||||
|
||||
const encrypt = xref.encrypt;
|
||||
|
||||
if (encrypt) {
|
||||
const transform = encrypt.createCipherTransform(datasetsRef.num, datasetsRef.gen);
|
||||
const transform = encrypt.createCipherTransform(xfaDatasetsRef.num, xfaDatasetsRef.gen);
|
||||
xfaData = transform.encryptString(xfaData);
|
||||
}
|
||||
|
||||
const data = `${datasetsRef.num} ${datasetsRef.gen} obj\n` + `<< /Type /EmbeddedFile /Length ${xfaData.length}>>\nstream\n` + xfaData + "\nendstream\nendobj\n";
|
||||
const data = `${xfaDatasetsRef.num} ${xfaDatasetsRef.gen} obj\n` + `<< /Type /EmbeddedFile /Length ${xfaData.length}>>\nstream\n` + xfaData + "\nendstream\nendobj\n";
|
||||
newRefs.push({
|
||||
ref: datasetsRef,
|
||||
ref: xfaDatasetsRef,
|
||||
data
|
||||
});
|
||||
}
|
||||
|
@ -43760,22 +43761,26 @@ function incrementalUpdate({
|
|||
xrefInfo,
|
||||
newRefs,
|
||||
xref = null,
|
||||
datasetsRef = null,
|
||||
hasDatasets = false,
|
||||
hasXfa = false,
|
||||
xfaDatasetsRef = null,
|
||||
hasXfaDatasetsEntry = false,
|
||||
acroFormRef = null,
|
||||
acroForm = null,
|
||||
xfaData = null
|
||||
}) {
|
||||
updateXFA({
|
||||
xfaData,
|
||||
datasetsRef,
|
||||
hasDatasets,
|
||||
acroFormRef,
|
||||
acroForm,
|
||||
newRefs,
|
||||
xref,
|
||||
xrefInfo
|
||||
});
|
||||
if (hasXfa) {
|
||||
updateXFA({
|
||||
xfaData,
|
||||
xfaDatasetsRef,
|
||||
hasXfaDatasetsEntry,
|
||||
acroFormRef,
|
||||
acroForm,
|
||||
newRefs,
|
||||
xref,
|
||||
xrefInfo
|
||||
});
|
||||
}
|
||||
|
||||
const newXref = new _primitives.Dict(null);
|
||||
const refForXrefTable = xrefInfo.newRef;
|
||||
let buffer, baseOffset;
|
||||
|
@ -60758,8 +60763,8 @@ Object.defineProperty(exports, "WorkerMessageHandler", ({
|
|||
|
||||
var _worker = __w_pdfjs_require__(1);
|
||||
|
||||
const pdfjsVersion = '2.11.283';
|
||||
const pdfjsBuild = '638115885';
|
||||
const pdfjsVersion = '2.11.298';
|
||||
const pdfjsBuild = 'd370a281c';
|
||||
})();
|
||||
|
||||
/******/ return __webpack_exports__;
|
||||
|
|
|
@ -279,6 +279,10 @@ class AppOptions {
|
|||
delete userOptions[name];
|
||||
}
|
||||
|
||||
static _hasUserOptions() {
|
||||
return Object.keys(userOptions).length > 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.AppOptions = AppOptions;
|
||||
|
@ -1095,6 +1099,7 @@ const PDFViewerApplication = {
|
|||
});
|
||||
await this.downloadManager.download(blob, url, filename, sourceEventType);
|
||||
} catch (reason) {
|
||||
console.error(`Error when saving the document: ${reason.message}`);
|
||||
await this.download({
|
||||
sourceEventType
|
||||
});
|
||||
|
@ -1511,7 +1516,12 @@ const PDFViewerApplication = {
|
|||
}
|
||||
|
||||
if (info.IsXFAPresent && !info.IsAcroFormPresent && !pdfDocument.isPureXfa) {
|
||||
console.warn("Warning: XFA support is not enabled");
|
||||
if (pdfDocument.loadingParams.enableXfa) {
|
||||
console.warn("Warning: XFA Foreground documents are not supported");
|
||||
} else {
|
||||
console.warn("Warning: XFA support is not enabled");
|
||||
}
|
||||
|
||||
this.fallback(_pdfjsLib.UNSUPPORTED_FEATURES.forms);
|
||||
} else if ((info.IsAcroFormPresent || info.IsXFAPresent) && !this.pdfViewer.renderForms) {
|
||||
console.warn("Warning: Interactive form support is not enabled");
|
||||
|
@ -2916,7 +2926,7 @@ exports.PDFPrintServiceFactory = PDFPrintServiceFactory;
|
|||
|
||||
/***/ }),
|
||||
/* 3 */
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
/***/ ((__unused_webpack_module, exports) => {
|
||||
|
||||
|
||||
|
||||
|
@ -2945,12 +2955,7 @@ exports.roundToDivide = roundToDivide;
|
|||
exports.scrollIntoView = scrollIntoView;
|
||||
exports.waitOnEventOrTimeout = waitOnEventOrTimeout;
|
||||
exports.watchScroll = watchScroll;
|
||||
exports.WaitOnType = exports.VERTICAL_PADDING = exports.UNKNOWN_SCALE = exports.TextLayerMode = exports.SpreadMode = exports.SidebarView = exports.ScrollMode = exports.SCROLLBAR_PADDING = exports.RendererType = exports.ProgressBar = exports.PresentationModeState = exports.MIN_SCALE = exports.MAX_SCALE = exports.MAX_AUTO_SCALE = exports.EventBus = exports.DEFAULT_SCALE_VALUE = exports.DEFAULT_SCALE_DELTA = exports.DEFAULT_SCALE = exports.CSS_UNITS = exports.AutoPrintRegExp = exports.AutomationEventBus = exports.animationStarted = void 0;
|
||||
|
||||
var _pdfjsLib = __webpack_require__(4);
|
||||
|
||||
const CSS_UNITS = _pdfjsLib.PixelsPerInch.CSS / _pdfjsLib.PixelsPerInch.PDF;
|
||||
exports.CSS_UNITS = CSS_UNITS;
|
||||
exports.WaitOnType = exports.VERTICAL_PADDING = exports.UNKNOWN_SCALE = exports.TextLayerMode = exports.SpreadMode = exports.SidebarView = exports.ScrollMode = exports.SCROLLBAR_PADDING = exports.RendererType = exports.ProgressBar = exports.PresentationModeState = exports.MIN_SCALE = exports.MAX_SCALE = exports.MAX_AUTO_SCALE = exports.EventBus = exports.DEFAULT_SCALE_VALUE = exports.DEFAULT_SCALE_DELTA = exports.DEFAULT_SCALE = exports.AutoPrintRegExp = exports.AutomationEventBus = exports.animationStarted = void 0;
|
||||
const DEFAULT_SCALE_VALUE = "auto";
|
||||
exports.DEFAULT_SCALE_VALUE = DEFAULT_SCALE_VALUE;
|
||||
const DEFAULT_SCALE = 1.0;
|
||||
|
@ -3441,14 +3446,13 @@ class EventBus {
|
|||
});
|
||||
}
|
||||
|
||||
dispatch(eventName) {
|
||||
dispatch(eventName, data) {
|
||||
const eventListeners = this._listeners[eventName];
|
||||
|
||||
if (!eventListeners || eventListeners.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const args = Array.prototype.slice.call(arguments, 1);
|
||||
let externalListeners;
|
||||
|
||||
for (const {
|
||||
|
@ -3465,12 +3469,12 @@ class EventBus {
|
|||
continue;
|
||||
}
|
||||
|
||||
listener.apply(null, args);
|
||||
listener(data);
|
||||
}
|
||||
|
||||
if (externalListeners) {
|
||||
for (const listener of externalListeners) {
|
||||
listener.apply(null, args);
|
||||
listener(data);
|
||||
}
|
||||
|
||||
externalListeners = null;
|
||||
|
@ -3506,15 +3510,13 @@ class EventBus {
|
|||
exports.EventBus = EventBus;
|
||||
|
||||
class AutomationEventBus extends EventBus {
|
||||
dispatch(eventName) {
|
||||
super.dispatch(...arguments);
|
||||
dispatch(eventName, data) {
|
||||
super.dispatch(eventName, data);
|
||||
const details = Object.create(null);
|
||||
|
||||
if (arguments.length > 1) {
|
||||
const obj = arguments[1];
|
||||
|
||||
for (const key in obj) {
|
||||
const value = obj[key];
|
||||
if (data) {
|
||||
for (const key in data) {
|
||||
const value = data[key];
|
||||
|
||||
if (key === "source") {
|
||||
if (value === window || value === document) {
|
||||
|
@ -9680,7 +9682,7 @@ class BaseViewer {
|
|||
throw new Error("Cannot initialize BaseViewer.");
|
||||
}
|
||||
|
||||
const viewerVersion = '2.11.283';
|
||||
const viewerVersion = '2.11.298';
|
||||
|
||||
if (_pdfjsLib.version !== viewerVersion) {
|
||||
throw new Error(`The API version "${_pdfjsLib.version}" does not match the Viewer version "${viewerVersion}".`);
|
||||
|
@ -9995,7 +9997,7 @@ class BaseViewer {
|
|||
this._optionalContentConfigPromise = optionalContentConfigPromise;
|
||||
const scale = this.currentScale;
|
||||
const viewport = firstPdfPage.getViewport({
|
||||
scale: scale * _ui_utils.CSS_UNITS
|
||||
scale: scale * _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS
|
||||
});
|
||||
const textLayerFactory = this.textLayerMode !== _ui_utils.TextLayerMode.DISABLE && !isPureXfa ? this : null;
|
||||
const annotationLayerFactory = this._annotationMode !== _pdfjsLib.AnnotationMode.DISABLE ? this : null;
|
||||
|
@ -10339,8 +10341,8 @@ class BaseViewer {
|
|||
widthScale,
|
||||
heightScale;
|
||||
const changeOrientation = pageView.rotation % 180 !== 0;
|
||||
const pageWidth = (changeOrientation ? pageView.height : pageView.width) / pageView.scale / _ui_utils.CSS_UNITS;
|
||||
const pageHeight = (changeOrientation ? pageView.width : pageView.height) / pageView.scale / _ui_utils.CSS_UNITS;
|
||||
const pageWidth = (changeOrientation ? pageView.height : pageView.width) / pageView.scale / _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS;
|
||||
const pageHeight = (changeOrientation ? pageView.width : pageView.height) / pageView.scale / _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS;
|
||||
let scale = 0;
|
||||
|
||||
switch (destArray[1].name) {
|
||||
|
@ -10386,8 +10388,8 @@ class BaseViewer {
|
|||
height = destArray[5] - y;
|
||||
const hPadding = this.removePageBorders ? 0 : _ui_utils.SCROLLBAR_PADDING;
|
||||
const vPadding = this.removePageBorders ? 0 : _ui_utils.VERTICAL_PADDING;
|
||||
widthScale = (this.container.clientWidth - hPadding) / width / _ui_utils.CSS_UNITS;
|
||||
heightScale = (this.container.clientHeight - vPadding) / height / _ui_utils.CSS_UNITS;
|
||||
widthScale = (this.container.clientWidth - hPadding) / width / _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS;
|
||||
heightScale = (this.container.clientHeight - vPadding) / height / _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS;
|
||||
scale = Math.min(Math.abs(widthScale), Math.abs(heightScale));
|
||||
break;
|
||||
|
||||
|
@ -10663,7 +10665,7 @@ class BaseViewer {
|
|||
});
|
||||
}
|
||||
|
||||
createAnnotationLayerBuilder(pageDiv, pdfPage, annotationStorage = null, imageResourcesPath = "", renderForms = true, l10n = _l10n_utils.NullL10n, enableScripting = null, hasJSActionsPromise = null, mouseState = null) {
|
||||
createAnnotationLayerBuilder(pageDiv, pdfPage, annotationStorage = null, imageResourcesPath = "", renderForms = true, l10n = _l10n_utils.NullL10n, enableScripting = null, hasJSActionsPromise = null, mouseState = null, fieldObjectsPromise = null) {
|
||||
return new _annotation_layer_builder.AnnotationLayerBuilder({
|
||||
pageDiv,
|
||||
pdfPage,
|
||||
|
@ -10675,6 +10677,7 @@ class BaseViewer {
|
|||
l10n,
|
||||
enableScripting: enableScripting ?? this.enableScripting,
|
||||
hasJSActionsPromise: hasJSActionsPromise || this.pdfDocument?.hasJSActions(),
|
||||
fieldObjectsPromise: fieldObjectsPromise || this.pdfDocument?.getFieldObjects(),
|
||||
mouseState: mouseState || this._scriptingManager?.mouseState
|
||||
});
|
||||
}
|
||||
|
@ -11091,6 +11094,7 @@ class AnnotationLayerBuilder {
|
|||
l10n = _l10n_utils.NullL10n,
|
||||
enableScripting = false,
|
||||
hasJSActionsPromise = null,
|
||||
fieldObjectsPromise = null,
|
||||
mouseState = null
|
||||
}) {
|
||||
this.pageDiv = pageDiv;
|
||||
|
@ -11103,49 +11107,51 @@ class AnnotationLayerBuilder {
|
|||
this.annotationStorage = annotationStorage;
|
||||
this.enableScripting = enableScripting;
|
||||
this._hasJSActionsPromise = hasJSActionsPromise;
|
||||
this._fieldObjectsPromise = fieldObjectsPromise;
|
||||
this._mouseState = mouseState;
|
||||
this.div = null;
|
||||
this._cancelled = false;
|
||||
}
|
||||
|
||||
render(viewport, intent = "display") {
|
||||
return Promise.all([this.pdfPage.getAnnotations({
|
||||
async render(viewport, intent = "display") {
|
||||
const [annotations, hasJSActions = false, fieldObjects = null] = await Promise.all([this.pdfPage.getAnnotations({
|
||||
intent
|
||||
}), this._hasJSActionsPromise]).then(([annotations, hasJSActions = false]) => {
|
||||
if (this._cancelled || annotations.length === 0) {
|
||||
return;
|
||||
}
|
||||
}), this._hasJSActionsPromise, this._fieldObjectsPromise]);
|
||||
|
||||
const parameters = {
|
||||
viewport: viewport.clone({
|
||||
dontFlip: true
|
||||
}),
|
||||
div: this.div,
|
||||
annotations,
|
||||
page: this.pdfPage,
|
||||
imageResourcesPath: this.imageResourcesPath,
|
||||
renderForms: this.renderForms,
|
||||
linkService: this.linkService,
|
||||
downloadManager: this.downloadManager,
|
||||
annotationStorage: this.annotationStorage,
|
||||
enableScripting: this.enableScripting,
|
||||
hasJSActions,
|
||||
mouseState: this._mouseState
|
||||
};
|
||||
if (this._cancelled || annotations.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.div) {
|
||||
_pdfjsLib.AnnotationLayer.update(parameters);
|
||||
} else {
|
||||
this.div = document.createElement("div");
|
||||
this.div.className = "annotationLayer";
|
||||
this.pageDiv.appendChild(this.div);
|
||||
parameters.div = this.div;
|
||||
const parameters = {
|
||||
viewport: viewport.clone({
|
||||
dontFlip: true
|
||||
}),
|
||||
div: this.div,
|
||||
annotations,
|
||||
page: this.pdfPage,
|
||||
imageResourcesPath: this.imageResourcesPath,
|
||||
renderForms: this.renderForms,
|
||||
linkService: this.linkService,
|
||||
downloadManager: this.downloadManager,
|
||||
annotationStorage: this.annotationStorage,
|
||||
enableScripting: this.enableScripting,
|
||||
hasJSActions,
|
||||
fieldObjects,
|
||||
mouseState: this._mouseState
|
||||
};
|
||||
|
||||
_pdfjsLib.AnnotationLayer.render(parameters);
|
||||
if (this.div) {
|
||||
_pdfjsLib.AnnotationLayer.update(parameters);
|
||||
} else {
|
||||
this.div = document.createElement("div");
|
||||
this.div.className = "annotationLayer";
|
||||
this.pageDiv.appendChild(this.div);
|
||||
parameters.div = this.div;
|
||||
|
||||
this.l10n.translate(this.div);
|
||||
}
|
||||
});
|
||||
_pdfjsLib.AnnotationLayer.render(parameters);
|
||||
|
||||
this.l10n.translate(this.div);
|
||||
}
|
||||
}
|
||||
|
||||
cancel() {
|
||||
|
@ -11165,7 +11171,7 @@ class AnnotationLayerBuilder {
|
|||
exports.AnnotationLayerBuilder = AnnotationLayerBuilder;
|
||||
|
||||
class DefaultAnnotationLayerFactory {
|
||||
createAnnotationLayerBuilder(pageDiv, pdfPage, annotationStorage = null, imageResourcesPath = "", renderForms = true, l10n = _l10n_utils.NullL10n, enableScripting = false, hasJSActionsPromise = null, mouseState = null) {
|
||||
createAnnotationLayerBuilder(pageDiv, pdfPage, annotationStorage = null, imageResourcesPath = "", renderForms = true, l10n = _l10n_utils.NullL10n, enableScripting = false, hasJSActionsPromise = null, mouseState = null, fieldObjectsPromise = null) {
|
||||
return new AnnotationLayerBuilder({
|
||||
pageDiv,
|
||||
pdfPage,
|
||||
|
@ -11176,6 +11182,7 @@ class DefaultAnnotationLayerFactory {
|
|||
annotationStorage,
|
||||
enableScripting,
|
||||
hasJSActionsPromise,
|
||||
fieldObjectsPromise,
|
||||
mouseState
|
||||
});
|
||||
}
|
||||
|
@ -11394,7 +11401,7 @@ class PDFPageView {
|
|||
this.pdfPageRotate = pdfPage.rotate;
|
||||
const totalRotation = (this.rotation + this.pdfPageRotate) % 360;
|
||||
this.viewport = pdfPage.getViewport({
|
||||
scale: this.scale * _ui_utils.CSS_UNITS,
|
||||
scale: this.scale * _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS,
|
||||
rotation: totalRotation
|
||||
});
|
||||
this.reset();
|
||||
|
@ -11561,7 +11568,7 @@ class PDFPageView {
|
|||
|
||||
const totalRotation = (this.rotation + this.pdfPageRotate) % 360;
|
||||
this.viewport = this.viewport.clone({
|
||||
scale: this.scale * _ui_utils.CSS_UNITS,
|
||||
scale: this.scale * _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS,
|
||||
rotation: totalRotation
|
||||
});
|
||||
|
||||
|
@ -11875,7 +11882,7 @@ class PDFPageView {
|
|||
|
||||
if (this._annotationMode !== _pdfjsLib.AnnotationMode.DISABLE && this.annotationLayerFactory) {
|
||||
if (!this.annotationLayer) {
|
||||
this.annotationLayer = this.annotationLayerFactory.createAnnotationLayerBuilder(div, pdfPage, null, this.imageResourcesPath, this._annotationMode === _pdfjsLib.AnnotationMode.ENABLE_FORMS, this.l10n, null, null, null);
|
||||
this.annotationLayer = this.annotationLayerFactory.createAnnotationLayerBuilder(div, pdfPage, null, this.imageResourcesPath, this._annotationMode === _pdfjsLib.AnnotationMode.ENABLE_FORMS, this.l10n, null, null, null, null);
|
||||
}
|
||||
|
||||
this._renderAnnotationLayer();
|
||||
|
@ -11968,7 +11975,7 @@ class PDFPageView {
|
|||
|
||||
if (this.useOnlyCssZoom) {
|
||||
const actualSizeViewport = viewport.clone({
|
||||
scale: _ui_utils.CSS_UNITS
|
||||
scale: _pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS
|
||||
});
|
||||
outputScale.sx *= actualSizeViewport.width / viewport.width;
|
||||
outputScale.sy *= actualSizeViewport.height / viewport.height;
|
||||
|
@ -14347,16 +14354,14 @@ Object.defineProperty(exports, "__esModule", ({
|
|||
}));
|
||||
exports.getXfaHtmlForPrinting = getXfaHtmlForPrinting;
|
||||
|
||||
var _ui_utils = __webpack_require__(3);
|
||||
var _pdfjsLib = __webpack_require__(4);
|
||||
|
||||
var _xfa_layer_builder = __webpack_require__(34);
|
||||
|
||||
var _pdfjsLib = __webpack_require__(4);
|
||||
|
||||
function getXfaHtmlForPrinting(printContainer, pdfDocument) {
|
||||
const xfaHtml = pdfDocument.allXfaHtml;
|
||||
const factory = new _xfa_layer_builder.DefaultXfaLayerFactory();
|
||||
const scale = Math.round(_ui_utils.CSS_UNITS * 100) / 100;
|
||||
const scale = Math.round(_pdfjsLib.PixelsPerInch.PDF_TO_CSS_UNITS * 100) / 100;
|
||||
|
||||
for (const xfaPage of xfaHtml.children) {
|
||||
const page = document.createElement("div");
|
||||
|
@ -14424,8 +14429,8 @@ var _app_options = __webpack_require__(1);
|
|||
|
||||
var _app = __webpack_require__(2);
|
||||
|
||||
const pdfjsVersion = '2.11.283';
|
||||
const pdfjsBuild = '638115885';
|
||||
const pdfjsVersion = '2.11.298';
|
||||
const pdfjsBuild = 'd370a281c';
|
||||
window.PDFViewerApplication = _app.PDFViewerApplication;
|
||||
window.PDFViewerApplicationOptions = _app_options.AppOptions;
|
||||
;
|
||||
|
|
|
@ -20,7 +20,7 @@ origin:
|
|||
|
||||
# Human-readable identifier for this version/release
|
||||
# Generally "version NNN", "tag SSS", "bookmark SSS"
|
||||
release: version 2.11.283
|
||||
release: version 2.11.298
|
||||
|
||||
# The package's license, where possible using the mnemonic from
|
||||
# https://spdx.org/licenses/
|
||||
|
|
Загрузка…
Ссылка в новой задаче