Bug 1704661 - Update pdf.js to version 2.9.44 r=calixte

Differential Revision: https://phabricator.services.mozilla.com/D111747
This commit is contained in:
Brendan Dahl 2021-04-14 01:38:01 +00:00
Родитель f6d17a387d
Коммит b19a3f2246
9 изменённых файлов: 1726 добавлений и 629 удалений

Просмотреть файл

@ -15,5 +15,6 @@
# Chrome notification bar messages and buttons
unsupported_feature=This PDF document might not be displayed correctly.
unsupported_feature_forms=This PDF document contains forms. The filling of form fields is not supported.
unsupported_feature_signatures=This PDF document contains digital signatures. Validation of signatures is not supported.
open_with_different_viewer=Open With Different Viewer
open_with_different_viewer.accessKey=o

Просмотреть файл

@ -246,3 +246,6 @@ password_cancel=Cancel
printing_not_supported=Warning: Printing is not fully supported by this browser.
printing_not_ready=Warning: The PDF is not fully loaded for printing.
web_fonts_disabled=Web fonts are disabled: unable to use embedded PDF fonts.
# LOCALIZATION NOTE (unsupported_feature_signatures): Should contain the same
# exact string as in the `chrome.properties` file.
unsupported_feature_signatures=This PDF document contains digital signatures. Validation of signatures is not supported.

Просмотреть файл

@ -1,5 +1,5 @@
This is the PDF.js project output, https://github.com/mozilla/pdf.js
Current extension version is: 2.8.320
Current extension version is: 2.9.44
Taken from upstream commit: ca7f54682
Taken from upstream commit: 6cf307000

Просмотреть файл

@ -926,6 +926,7 @@ const UNSUPPORTED_FEATURES = {
unknown: "unknown",
forms: "forms",
javaScript: "javaScript",
signatures: "signatures",
smask: "smask",
shadingPattern: "shadingPattern",
font: "font",
@ -1752,7 +1753,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
return worker.messageHandler.sendWithPromise("GetDocRequest", {
docId,
apiVersion: '2.8.320',
apiVersion: '2.9.44',
source: {
data: source.data,
url: source.url,
@ -1896,7 +1897,7 @@ class PDFDocumentProxy {
}
get annotationStorage() {
return (0, _util.shadow)(this, "annotationStorage", new _annotation_storage.AnnotationStorage());
return this._transport.annotationStorage;
}
get numPages() {
@ -1991,8 +1992,8 @@ class PDFDocumentProxy {
return this._transport.getStats();
}
cleanup() {
return this._transport.startCleanup();
cleanup(keepLoadedFonts = false) {
return this._transport.startCleanup(keepLoadedFonts || this.isPureXfa);
}
destroy() {
@ -2007,8 +2008,8 @@ class PDFDocumentProxy {
return this._transport.loadingTask;
}
saveDocument(annotationStorage) {
return this._transport.saveDocument(annotationStorage);
saveDocument() {
return this._transport.saveDocument();
}
getFieldObjects() {
@ -2083,12 +2084,12 @@ class PDFPageProxy {
getAnnotations({
intent = null
} = {}) {
if (!this.annotationsPromise || this.annotationsIntent !== intent) {
this.annotationsPromise = this._transport.getAnnotations(this._pageIndex, intent);
this.annotationsIntent = intent;
if (!this._annotationsPromise || this._annotationsIntent !== intent) {
this._annotationsPromise = this._transport.getAnnotations(this._pageIndex, intent);
this._annotationsIntent = intent;
}
return this.annotationsPromise;
return this._annotationsPromise;
}
getJSActions() {
@ -2109,7 +2110,7 @@ class PDFPageProxy {
imageLayer = null,
canvasFactory = null,
background = null,
annotationStorage = null,
includeAnnotationStorage = false,
optionalContentConfigPromise = null
}) {
if (this._stats) {
@ -2142,6 +2143,7 @@ class PDFPageProxy {
const webGLContext = new _webgl.WebGLContext({
enable: enableWebGL
});
const annotationStorage = includeAnnotationStorage ? this._transport.annotationStorage.serializable : null;
if (!intentState.displayReadyCapability) {
intentState.displayReadyCapability = (0, _util.createPromiseCapability)();
@ -2159,16 +2161,12 @@ class PDFPageProxy {
pageIndex: this._pageIndex,
intent: renderingIntent,
renderInteractiveForms: renderInteractiveForms === true,
annotationStorage: annotationStorage?.serializable || null
annotationStorage
});
}
const complete = error => {
const i = intentState.renderTasks.indexOf(internalRenderTask);
if (i >= 0) {
intentState.renderTasks.splice(i, 1);
}
intentState.renderTasks.delete(internalRenderTask);
if (this.cleanupAfterRender || renderingIntent === "print") {
this.pendingCleanup = true;
@ -2212,12 +2210,7 @@ class PDFPageProxy {
useRequestAnimationFrame: renderingIntent !== "print",
pdfBug: this._pdfBug
});
if (!intentState.renderTasks) {
intentState.renderTasks = [];
}
intentState.renderTasks.push(internalRenderTask);
(intentState.renderTasks ||= new Set()).add(internalRenderTask);
const renderTask = internalRenderTask.task;
Promise.all([intentState.displayReadyCapability.promise, optionalContentConfigPromise]).then(([transparency, optionalContentConfig]) => {
if (this.pendingCleanup) {
@ -2242,11 +2235,7 @@ class PDFPageProxy {
function operatorListChanged() {
if (intentState.operatorList.lastChunk) {
intentState.opListReadCapability.resolve(intentState.operatorList);
const i = intentState.renderTasks.indexOf(opListTask);
if (i >= 0) {
intentState.renderTasks.splice(i, 1);
}
intentState.renderTasks.delete(opListTask);
}
}
@ -2266,8 +2255,7 @@ class PDFPageProxy {
opListTask = Object.create(null);
opListTask.operatorListChanged = operatorListChanged;
intentState.opListReadCapability = (0, _util.createPromiseCapability)();
intentState.renderTasks = [];
intentState.renderTasks.push(opListTask);
(intentState.renderTasks ||= new Set()).add(opListTask);
intentState.operatorList = {
fnArray: [],
argsArray: [],
@ -2289,13 +2277,15 @@ class PDFPageProxy {
streamTextContent({
normalizeWhitespace = false,
disableCombineTextItems = false
disableCombineTextItems = false,
includeMarkedContent = false
} = {}) {
const TEXT_CONTENT_CHUNK_SIZE = 100;
return this._transport.messageHandler.sendWithStream("GetTextContent", {
pageIndex: this._pageIndex,
normalizeWhitespace: normalizeWhitespace === true,
combineTextItems: disableCombineTextItems !== true
combineTextItems: disableCombineTextItems !== true,
includeMarkedContent: includeMarkedContent === true
}, {
highWaterMark: TEXT_CONTENT_CHUNK_SIZE,
@ -2334,6 +2324,10 @@ class PDFPageProxy {
});
}
getStructTree() {
return this._structTreePromise ||= this._transport.getStructTree(this._pageIndex);
}
_destroy() {
this.destroyed = true;
this._transport.pageCache[this._pageIndex] = null;
@ -2357,9 +2351,10 @@ class PDFPageProxy {
}
this.objs.clear();
this.annotationsPromise = null;
this._annotationsPromise = null;
this._jsActionsPromise = null;
this._xfaPromise = null;
this._structTreePromise = null;
this.pendingCleanup = false;
return Promise.all(waitOn);
}
@ -2378,7 +2373,7 @@ class PDFPageProxy {
renderTasks,
operatorList
} of this._intentStates.values()) {
if (renderTasks.length !== 0 || !operatorList.lastChunk) {
if (renderTasks.size > 0 || !operatorList.lastChunk) {
return false;
}
}
@ -2386,9 +2381,10 @@ class PDFPageProxy {
this._intentStates.clear();
this.objs.clear();
this.annotationsPromise = null;
this._annotationsPromise = null;
this._jsActionsPromise = null;
this._xfaPromise = null;
this._structTreePromise = null;
if (resetStats && this._stats) {
this._stats = new _display_utils.StatTimer();
@ -2422,8 +2418,8 @@ class PDFPageProxy {
intentState.operatorList.lastChunk = operatorListChunk.lastChunk;
for (let i = 0; i < intentState.renderTasks.length; i++) {
intentState.renderTasks[i].operatorListChanged();
for (const internalRenderTask of intentState.renderTasks) {
internalRenderTask.operatorListChanged();
}
if (operatorListChunk.lastChunk) {
@ -2469,8 +2465,8 @@ class PDFPageProxy {
if (intentState.operatorList) {
intentState.operatorList.lastChunk = true;
for (let i = 0; i < intentState.renderTasks.length; i++) {
intentState.renderTasks[i].operatorListChanged();
for (const internalRenderTask of intentState.renderTasks) {
internalRenderTask.operatorListChanged();
}
this._tryCleanup();
@ -2501,7 +2497,7 @@ class PDFPageProxy {
}
if (!force) {
if (intentState.renderTasks.length !== 0) {
if (intentState.renderTasks.size > 0) {
return;
}
@ -2959,8 +2955,8 @@ class WorkerTransport {
this.setupMessageHandler();
}
get loadingTaskSettled() {
return this.loadingTask._capability.settled;
get annotationStorage() {
return (0, _util.shadow)(this, "annotationStorage", new _annotation_storage.AnnotationStorage());
}
destroy() {
@ -2983,18 +2979,13 @@ class WorkerTransport {
});
this.pageCache.length = 0;
this.pagePromises.length = 0;
const terminated = this.messageHandler.sendWithPromise("Terminate", null);
waitOn.push(terminated);
if (this.loadingTaskSettled) {
const annotationStorageResetModified = this.loadingTask.promise.then(pdfDocument => {
if (pdfDocument.hasOwnProperty("annotationStorage")) {
pdfDocument.annotationStorage.resetModified();
}
}).catch(() => {});
waitOn.push(annotationStorageResetModified);
if (this.hasOwnProperty("annotationStorage")) {
this.annotationStorage.resetModified();
}
const terminated = this.messageHandler.sendWithPromise("Terminate", null);
waitOn.push(terminated);
Promise.all(waitOn).then(() => {
this.commonObjs.clear();
this.fontLoader.clear();
@ -3388,15 +3379,13 @@ class WorkerTransport {
});
}
saveDocument(annotationStorage) {
saveDocument() {
return this.messageHandler.sendWithPromise("SaveDocument", {
numPages: this._numPages,
annotationStorage: annotationStorage?.serializable || null,
annotationStorage: this.annotationStorage.serializable,
filename: this._fullReader?.filename ?? null
}).finally(() => {
if (annotationStorage) {
annotationStorage.resetModified();
}
this.annotationStorage.resetModified();
});
}
@ -3470,6 +3459,12 @@ class WorkerTransport {
});
}
getStructTree(pageIndex) {
return this.messageHandler.sendWithPromise("GetStructTree", {
pageIndex
});
}
getOutline() {
return this.messageHandler.sendWithPromise("GetOutline", null);
}
@ -3503,24 +3498,34 @@ class WorkerTransport {
return this.messageHandler.sendWithPromise("GetStats", null);
}
startCleanup() {
return this.messageHandler.sendWithPromise("Cleanup", null).then(() => {
for (let i = 0, ii = this.pageCache.length; i < ii; i++) {
const page = this.pageCache[i];
async startCleanup(keepLoadedFonts = false) {
await this.messageHandler.sendWithPromise("Cleanup", null);
if (page) {
const cleanupSuccessful = page.cleanup();
if (this.destroyed) {
return;
}
if (!cleanupSuccessful) {
throw new Error(`startCleanup: Page ${i + 1} is currently rendering.`);
}
}
for (let i = 0, ii = this.pageCache.length; i < ii; i++) {
const page = this.pageCache[i];
if (!page) {
continue;
}
this.commonObjs.clear();
const cleanupSuccessful = page.cleanup();
if (!cleanupSuccessful) {
throw new Error(`startCleanup: Page ${i + 1} is currently rendering.`);
}
}
this.commonObjs.clear();
if (!keepLoadedFonts) {
this.fontLoader.clear();
this._hasJSActionsPromise = null;
});
}
this._hasJSActionsPromise = null;
}
get loadingParams() {
@ -3775,9 +3780,9 @@ const InternalRenderTask = function InternalRenderTaskClosure() {
return InternalRenderTask;
}();
const version = '2.8.320';
const version = '2.9.44';
exports.version = version;
const build = 'ca7f54682';
const build = '6cf307000';
exports.build = build;
/***/ }),
@ -4074,8 +4079,6 @@ Object.defineProperty(exports, "__esModule", ({
}));
exports.AnnotationStorage = void 0;
var _display_utils = __w_pdfjs_require__(1);
var _util = __w_pdfjs_require__(2);
class AnnotationStorage {
@ -4092,18 +4095,6 @@ class AnnotationStorage {
return obj !== undefined ? obj : defaultValue;
}
getOrCreateValue(key, defaultValue) {
(0, _display_utils.deprecated)("Use getValue instead.");
if (this._storage.has(key)) {
return this._storage.get(key);
}
this._storage.set(key, defaultValue);
return defaultValue;
}
setValue(key, value) {
const obj = this._storage.get(key);
@ -10874,6 +10865,25 @@ const renderTextLayer = function renderTextLayerClosure() {
_processItems(items, styleCache) {
for (let i = 0, len = items.length; i < len; i++) {
if (items[i].str === undefined) {
if (items[i].type === "beginMarkedContentProps" || items[i].type === "beginMarkedContent") {
const parent = this._container;
this._container = document.createElement("span");
this._container.classList.add("markedContent");
if (items[i].id !== null) {
this._container.setAttribute("id", `${items[i].id}`);
}
parent.appendChild(this._container);
} else if (items[i].type === "endMarkedContent") {
this._container = this._container.parentNode;
}
continue;
}
this._textContentItemsStr.push(items[i].str);
appendText(this, items[i], styleCache, this._layoutTextCtx);
@ -11454,8 +11464,8 @@ var _svg = __w_pdfjs_require__(21);
var _xfa_layer = __w_pdfjs_require__(22);
const pdfjsVersion = '2.8.320';
const pdfjsBuild = 'ca7f54682';
const pdfjsVersion = '2.9.44';
const pdfjsBuild = '6cf307000';
;
})();

Просмотреть файл

@ -4768,8 +4768,8 @@ Object.defineProperty(exports, "initSandbox", ({
var _initialization = __w_pdfjs_require__(1);
const pdfjsVersion = '2.8.320';
const pdfjsBuild = 'ca7f54682';
const pdfjsVersion = '2.9.44';
const pdfjsBuild = '6cf307000';
})();
/******/ return __webpack_exports__;

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -24,7 +24,7 @@
line-height: 1;
}
.textLayer > span {
.textLayer span {
color: transparent;
position: absolute;
white-space: pre;
@ -269,20 +269,6 @@
cursor: pointer;
}
*/* Copyright 2021 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
.xfaLayer {
position: absolute;
@ -301,6 +287,7 @@
text-decoration: inherit;
vertical-align: inherit;
box-sizing: border-box;
background: transparent;
}
.xfaFont {
@ -315,19 +302,23 @@
}
.xfaDraw {
z-index: 200;
z-index: 100;
}
.xfaExclgroup {
z-index: 300;
z-index: 200;
}
.xfaField {
z-index: 300;
}
.xfaRich {
z-index: 300;
}
.xfaSubform {
z-index: 100;
z-index: 200;
}
.xfaLabel {
@ -348,6 +339,7 @@
height: 100%;
flex: 1 1 auto;
border: none;
resize: none;
}
.xfaLabel > input[type="checkbox"] {
@ -394,6 +386,16 @@
background: Highlight;
}
.xfaRich {
white-space: pre-wrap;
}
.xfaImage,
.xfaRich {
width: 100%;
height: 100%;
}
.xfaLrTb,
.xfaRlTb,
.xfaTb,
@ -405,6 +407,10 @@
position: relative;
}
.xfaArea {
position: relative;
}
.xfaValignMiddle {
display: flex;
align-items: center;
@ -445,6 +451,26 @@
flex: 1;
}
:root {
--pdfViewer-padding-bottom: none;
--page-margin: 1px auto -8px;
--page-border: 9px solid transparent;
--spreadHorizontalWrapped-margin-LR: -3.5px;
}
@media screen and (forced-colors: active) {
:root {
--pdfViewer-padding-bottom: 9px;
--page-margin: 9px auto 0;
--page-border: none;
--spreadHorizontalWrapped-margin-LR: 4.5px;
}
}
.pdfViewer {
padding-bottom: var(--pdfViewer-padding-bottom);
}
.pdfViewer .canvasWrapper {
overflow: hidden;
}
@ -453,10 +479,10 @@
direction: ltr;
width: 816px;
height: 1056px;
margin: 1px auto -8px;
margin: var(--page-margin);
position: relative;
overflow: visible;
border: 9px solid transparent;
border: var(--page-border);
background-clip: content-box;
border-image: url(images/shadow.png) 9 9 repeat;
background-color: rgba(255, 255, 255, 1);
@ -508,8 +534,8 @@
.spread .page,
.pdfViewer.scrollHorizontal .page,
.pdfViewer.scrollWrapped .page {
margin-left: -3.5px;
margin-right: -3.5px;
margin-left: var(--spreadHorizontalWrapped-margin-LR);
margin-right: var(--spreadHorizontalWrapped-margin-LR);
}
.pdfViewer.removePageBorders .spread .page,
@ -570,19 +596,21 @@
--main-color: rgba(12, 12, 13, 1);
--body-bg-color: rgba(237, 237, 240, 1);
--errorWrapper-bg-color: rgba(255, 74, 74, 1);
--errorWrapper-bg-color: rgba(255, 110, 110, 1);
--progressBar-color: rgba(10, 132, 255, 1);
--progressBar-indeterminate-bg-color: rgba(221, 221, 222, 1);
--progressBar-indeterminate-blend-color: rgba(116, 177, 239, 1);
--scrollbar-color: auto;
--scrollbar-bg-color: auto;
--toolbar-icon-bg-color: rgba(0, 0, 0, 1);
--toolbar-icon-hover-bg-color: rgba(0, 0, 0, 1);
--sidebar-narrow-bg-color: rgba(237, 237, 240, 0.9);
--sidebar-toolbar-bg-color: rgba(245, 246, 247, 1);
--toolbar-bg-color: rgba(249, 249, 250, 1);
--toolbar-border-color: rgba(204, 204, 204, 1);
--button-hover-color: rgba(221, 222, 223, 1);
--toggled-btn-color: rgba(0, 0, 0, 1);
--toggled-btn-bg-color: rgba(0, 0, 0, 0.3);
--toggled-hover-active-btn-color: rgba(0, 0, 0, 0.4);
--dropdown-btn-bg-color: rgba(215, 215, 219, 1);
@ -598,10 +626,12 @@
--sidebaritem-bg-color: rgba(0, 0, 0, 0.15);
--doorhanger-bg-color: rgba(255, 255, 255, 1);
--doorhanger-border-color: rgba(12, 12, 13, 0.2);
--doorhanger-hover-color: rgba(237, 237, 237, 1);
--doorhanger-hover-color: rgba(12, 12, 13, 1);
--doorhanger-hover-bg-color: rgba(237, 237, 237, 1);
--doorhanger-separator-color: rgba(222, 222, 222, 1);
--overlay-button-border: 0 none;
--overlay-button-bg-color: rgba(12, 12, 13, 0.1);
--overlay-button-hover-color: rgba(12, 12, 13, 0.3);
--overlay-button-hover-bg-color: rgba(12, 12, 13, 0.3);
--loading-icon: url(images/loading.svg);
--treeitem-expanded-icon: url(images/treeitem-expanded.svg);
@ -645,19 +675,21 @@
:root {
--main-color: rgba(249, 249, 250, 1);
--body-bg-color: rgba(42, 42, 46, 1);
--errorWrapper-bg-color: rgba(199, 17, 17, 1);
--errorWrapper-bg-color: rgba(169, 14, 14, 1);
--progressBar-color: rgba(0, 96, 223, 1);
--progressBar-indeterminate-bg-color: rgba(40, 40, 43, 1);
--progressBar-indeterminate-blend-color: rgba(20, 68, 133, 1);
--scrollbar-color: rgba(121, 121, 123, 1);
--scrollbar-bg-color: rgba(35, 35, 39, 1);
--toolbar-icon-bg-color: rgba(255, 255, 255, 1);
--toolbar-icon-hover-bg-color: rgba(255, 255, 255, 1);
--sidebar-narrow-bg-color: rgba(42, 42, 46, 0.9);
--sidebar-toolbar-bg-color: rgba(50, 50, 52, 1);
--toolbar-bg-color: rgba(56, 56, 61, 1);
--toolbar-border-color: rgba(12, 12, 13, 1);
--button-hover-color: rgba(102, 102, 103, 1);
--toggled-btn-color: rgba(255, 255, 255, 1);
--toggled-btn-bg-color: rgba(0, 0, 0, 0.3);
--toggled-hover-active-btn-color: rgba(0, 0, 0, 0.4);
--dropdown-btn-bg-color: rgba(74, 74, 79, 1);
@ -673,10 +705,11 @@
--sidebaritem-bg-color: rgba(255, 255, 255, 0.15);
--doorhanger-bg-color: rgba(74, 74, 79, 1);
--doorhanger-border-color: rgba(39, 39, 43, 1);
--doorhanger-hover-color: rgba(93, 94, 98, 1);
--doorhanger-hover-color: rgba(249, 249, 250, 1);
--doorhanger-hover-bg-color: rgba(93, 94, 98, 1);
--doorhanger-separator-color: rgba(92, 92, 97, 1);
--overlay-button-bg-color: rgba(92, 92, 97, 1);
--overlay-button-hover-color: rgba(115, 115, 115, 1);
--overlay-button-hover-bg-color: rgba(115, 115, 115, 1);
/* This image is used in <input> elements, which unfortunately means that
* the `mask-image` approach used with all of the other images doesn't work
@ -685,6 +718,26 @@
}
}
@media screen and (forced-colors: active) {
:root {
--main-color: ButtonText;
--button-hover-color: Highlight;
--doorhanger-hover-bg-color: Highlight;
--toolbar-icon-opacity: 1;
--toolbar-icon-bg-color: ButtonText;
--toolbar-icon-hover-bg-color: ButtonFace;
--toggled-btn-color: HighlightText;
--toggled-btn-bg-color: LinkText;
--doorhanger-hover-color: ButtonFace;
--doorhanger-border-color-whcm: 1px solid ButtonText;
--doorhanger-triangle-opacity-whcm: 0;
--overlay-button-border: 1px solid Highlight;
--overlay-button-hover-bg-color: Highlight;
--overlay-button-hover-color: ButtonFace;
--field-border-color: ButtonText;
}
}
* {
padding: 0;
margin: 0;
@ -719,7 +772,7 @@ select {
display: none !important;
}
.pdfViewer.enablePermissions .textLayer > span {
.pdfViewer.enablePermissions .textLayer span {
user-select: none !important;
cursor: not-allowed;
}
@ -739,12 +792,12 @@ select {
display: none;
}
.pdfPresentationMode:fullscreen .textLayer > span {
.pdfPresentationMode:fullscreen .textLayer span {
cursor: none;
}
.pdfPresentationMode.pdfPresentationModeControls > *,
.pdfPresentationMode.pdfPresentationModeControls .textLayer > span {
.pdfPresentationMode.pdfPresentationModeControls .textLayer span {
cursor: default;
}
@ -768,10 +821,12 @@ select {
html[dir="ltr"] #sidebarContainer {
transition-property: left;
left: calc(0px - var(--sidebar-width));
border-right: var(--doorhanger-border-color-whcm);
}
html[dir="rtl"] #sidebarContainer {
transition-property: right;
right: calc(0px - var(--sidebar-width));
border-left: var(--doorhanger-border-color-whcm);
}
#outerContainer.sidebarResizing #sidebarContainer {
@ -1077,6 +1132,7 @@ html[dir="rtl"] .findbar .splitToolbarButton > .findNext {
.findbar label:hover,
.findbar input:focus + label {
color: var(--toggled-btn-color);
background-color: var(--button-hover-color);
}
@ -1091,6 +1147,7 @@ html[dir="rtl"] #findInput {
.findbar .toolbarField[type="checkbox"]:checked + .toolbarLabel {
background-color: var(--toggled-btn-bg-color) !important;
color: var(--toggled-btn-color);
}
#findInput {
@ -1141,6 +1198,7 @@ html[dir="rtl"] .secondaryToolbar {
border-radius: 2px;
box-shadow: 0 1px 5px var(--doorhanger-border-color),
0 0 0 1px var(--doorhanger-border-color);
border: var(--doorhanger-border-color-whcm);
}
.doorHanger:after,
.doorHanger:before,
@ -1153,6 +1211,7 @@ html[dir="rtl"] .secondaryToolbar {
width: 0;
position: absolute;
pointer-events: none;
opacity: var(--doorhanger-triangle-opacity-whcm);
}
.doorHanger:after,
.doorHangerRight:after {
@ -1198,7 +1257,7 @@ html[dir="ltr"] .doorHangerRight:before {
background-color: rgba(217, 217, 217, 1);
color: rgba(82, 82, 82, 1);
text-align: center;
padding: 3px 4px;
padding: 4px 5px;
margin: 5px;
}
@ -1265,13 +1324,15 @@ html[dir="rtl"] .splitToolbarButton > .toolbarButton {
width: 28px;
height: 28px;
}
.overlayButton {
background-color: var(--overlay-button-bg-color);
}
.overlayButton:hover,
.overlayButton:focus {
background-color: var(--overlay-button-hover-color);
background-color: var(--overlay-button-hover-bg-color);
}
.overlayButton:hover > span,
.overlayButton:focus > span {
color: var(--overlay-button-hover-color);
}
.toolbarButton > span {
@ -1364,13 +1425,23 @@ html[dir="rtl"] #toolbarViewerLeft > .toolbarButton:first-child {
}
.secondaryToolbarButton:hover,
.secondaryToolbarButton:focus {
background-color: var(--doorhanger-hover-color);
background-color: var(--doorhanger-hover-bg-color);
color: var(--doorhanger-hover-color);
}
.toolbarButton.toggled,
.splitToolbarButton.toggled > .toolbarButton.toggled,
.secondaryToolbarButton.toggled {
background-color: var(--toggled-btn-bg-color);
color: var(--toggled-btn-color);
}
.secondaryToolbarButton.toggled::before {
background-color: var(--toggled-btn-color);
}
.toolbarButton.toggled::before {
background-color: var(--toggled-btn-color);
}
.toolbarButton.toggled:hover:active,
@ -1415,16 +1486,15 @@ html[dir="ltr"] .dropdownToolbarButton > select {
html[dir="rtl"] .dropdownToolbarButton > select {
padding-right: 4px;
}
.dropdownToolbarButton > select:hover {
background-color: var(--button-hover-color);
}
.dropdownToolbarButton > select:hover,
.dropdownToolbarButton > select:focus {
background-color: var(--button-hover-color);
color: var(--toggled-btn-color);
}
.dropdownToolbarButton > select > option {
background: var(--doorhanger-bg-color);
color: var(--main-color);
}
#customScaleOption {
@ -1457,12 +1527,25 @@ html[dir="rtl"] .dropdownToolbarButton > select {
mask-size: cover;
}
.dropdownToolbarButton:hover::after,
.dropdownToolbarButton:focus::after,
.dropdownToolbarButton:active::after {
background-color: var(--toolbar-icon-hover-bg-color);
}
.toolbarButton::before {
opacity: var(--toolbar-icon-opacity);
top: 6px;
left: 6px;
}
.toolbarButton:hover::before,
.toolbarButton:focus::before,
.secondaryToolbarButton:hover::before,
.secondaryToolbarButton:focus::before {
background-color: var(--toolbar-icon-hover-bg-color);
}
.secondaryToolbarButton::before {
opacity: var(--doorhanger-icon-opacity);
top: 5px;
@ -1746,9 +1829,8 @@ html[dir="rtl"] .toolbarField[type="checkbox"] {
.toolbarLabel {
min-width: 16px;
padding: 6px;
padding: 7px;
margin: 2px;
border: 1px solid rgba(0, 0, 0, 0);
border-radius: 2px;
color: var(--main-color);
font-size: 12px;
@ -1759,10 +1841,10 @@ html[dir="rtl"] .toolbarField[type="checkbox"] {
}
html[dir="ltr"] #numPages.toolbarLabel {
padding-left: 2px;
padding-left: 3px;
}
html[dir="rtl"] #numPages.toolbarLabel {
padding-right: 2px;
padding-right: 3px;
}
#thumbnailView {
@ -1977,6 +2059,9 @@ html[dir="rtl"] .treeItemToggler::before {
width: auto;
margin: 3px 4px 2px !important;
padding: 2px 11px;
color: var(--main-color);
background-color: var(--overlay-button-bg-color);
border: var(--overlay-button-border) !important;
}
#overlayContainer {
@ -2145,19 +2230,19 @@ html[dir="rtl"] #documentPropertiesOverlay .row > * {
mix-blend-mode: screen;
}
#viewer.textLayer-visible .textLayer > span {
#viewer.textLayer-visible .textLayer span {
background-color: rgba(255, 255, 0, 0.1);
color: rgba(0, 0, 0, 1);
border: solid 1px rgba(255, 0, 0, 0.5);
box-sizing: border-box;
}
#viewer.textLayer-hover .textLayer > span:hover {
#viewer.textLayer-hover .textLayer span:hover {
background-color: rgba(255, 255, 255, 1);
color: rgba(0, 0, 0, 1);
}
#viewer.textLayer-shadow .textLayer > span {
#viewer.textLayer-shadow .textLayer span {
background-color: rgba(255, 255, 255, 0.6);
color: rgba(0, 0, 0, 1);
}

Просмотреть файл

@ -351,13 +351,13 @@ var _pdf_thumbnail_viewer = __webpack_require__(25);
var _pdf_viewer = __webpack_require__(27);
var _secondary_toolbar = __webpack_require__(34);
var _secondary_toolbar = __webpack_require__(35);
var _toolbar = __webpack_require__(36);
var _toolbar = __webpack_require__(37);
var _viewer_compatibility = __webpack_require__(2);
var _view_history = __webpack_require__(37);
var _view_history = __webpack_require__(38);
const DEFAULT_SCALE_DELTA = 1.1;
const DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT = 5000;
@ -433,7 +433,7 @@ exports.DefaultExternalServices = DefaultExternalServices;
const PDFViewerApplication = {
initialBookmark: document.location.hash.substring(1),
_initializedCapability: (0, _pdfjsLib.createPromiseCapability)(),
fellback: false,
_fellback: false,
appConfig: null,
pdfDocument: null,
pdfLoadingTask: null,
@ -640,7 +640,7 @@ const PDFViewerApplication = {
this.eventBus = eventBus;
this.overlayManager = new _overlay_manager.OverlayManager();
const pdfRenderingQueue = new _pdf_rendering_queue.PDFRenderingQueue();
pdfRenderingQueue.onIdle = this.cleanup.bind(this);
pdfRenderingQueue.onIdle = this._cleanup.bind(this);
this.pdfRenderingQueue = pdfRenderingQueue;
const pdfLinkService = new _pdf_link_service.PDFLinkService({
eventBus,
@ -919,7 +919,7 @@ const PDFViewerApplication = {
this._unblockDocumentLoadEvent();
if (!this.pdfLoadingTask) {
return undefined;
return;
}
const promises = [];
@ -935,6 +935,7 @@ const PDFViewerApplication = {
}
webViewerResetPermissions();
this._fellback = false;
this.store = null;
this.isInitialViewSet = false;
this.downloadComplete = false;
@ -971,7 +972,6 @@ const PDFViewerApplication = {
}
await Promise.all(promises);
return undefined;
},
async open(file, args) {
@ -1059,28 +1059,31 @@ const PDFViewerApplication = {
});
},
download({
sourceEventType = "download"
} = {}) {
function downloadByUrl() {
downloadManager.downloadUrl(url, filename);
}
const downloadManager = this.downloadManager,
url = this.baseUrl,
filename = this._docFilename;
if (!this.pdfDocument || !this.downloadComplete) {
downloadByUrl();
_ensureDownloadComplete() {
if (this.pdfDocument && this.downloadComplete) {
return;
}
this.pdfDocument.getData().then(function (data) {
throw new Error("PDF document not downloaded.");
},
async download({
sourceEventType = "download"
} = {}) {
const url = this.baseUrl,
filename = this._docFilename;
try {
this._ensureDownloadComplete();
const data = await this.pdfDocument.getData();
const blob = new Blob([data], {
type: "application/pdf"
});
downloadManager.download(blob, url, filename, sourceEventType);
}).catch(downloadByUrl);
await this.downloadManager.download(blob, url, filename, sourceEventType);
} catch (reason) {
await this.downloadManager.downloadUrl(url, filename);
}
},
async save({
@ -1090,32 +1093,27 @@ const PDFViewerApplication = {
return;
}
const downloadManager = this.downloadManager,
url = this.baseUrl,
filename = this._docFilename;
if (!this.pdfDocument || !this.downloadComplete) {
this.download({
sourceEventType
});
return;
}
this._saveInProgress = true;
await this.pdfScriptingManager.dispatchWillSave();
this.pdfDocument.saveDocument(this.pdfDocument.annotationStorage).then(data => {
const url = this.baseUrl,
filename = this._docFilename;
try {
this._ensureDownloadComplete();
const data = await this.pdfDocument.saveDocument();
const blob = new Blob([data], {
type: "application/pdf"
});
downloadManager.download(blob, url, filename, sourceEventType);
}).catch(() => {
this.download({
await this.downloadManager.download(blob, url, filename, sourceEventType);
} catch (reason) {
await this.download({
sourceEventType
});
}).finally(async () => {
} finally {
await this.pdfScriptingManager.dispatchDidSave();
this._saveInProgress = false;
});
}
},
downloadOrSave(options) {
@ -1152,11 +1150,11 @@ const PDFViewerApplication = {
return;
}
if (this.fellback) {
if (this._fellback) {
return;
}
this.fellback = true;
this._fellback = true;
this.externalServices.fallback({
featureId,
url: this.baseUrl
@ -1379,17 +1377,29 @@ const PDFViewerApplication = {
});
onePageRendered.then(() => {
pdfDocument.getOutline().then(outline => {
if (pdfDocument !== this.pdfDocument) {
return;
}
this.pdfOutlineViewer.render({
outline,
pdfDocument
});
});
pdfDocument.getAttachments().then(attachments => {
if (pdfDocument !== this.pdfDocument) {
return;
}
this.pdfAttachmentViewer.render({
attachments
});
});
pdfViewer.optionalContentConfigPromise.then(optionalContentConfig => {
if (pdfDocument !== this.pdfDocument) {
return;
}
this.pdfLayerViewer.render({
optionalContentConfig,
pdfDocument
@ -1544,6 +1554,11 @@ const PDFViewerApplication = {
this._delayedFallback(_pdfjsLib.UNSUPPORTED_FEATURES.forms);
}
if (info.IsSignaturesPresent) {
console.warn("Warning: Digital signatures validation is not supported");
this.fallback(_pdfjsLib.UNSUPPORTED_FEATURES.signatures);
}
let versionId = "other";
if (KNOWN_VERSIONS.includes(info.PDFFormatVersion)) {
@ -1676,11 +1691,11 @@ const PDFViewerApplication = {
annotationStorage
} = pdfDocument;
annotationStorage.onSetModified = function () {
annotationStorage.onSetModified = () => {
window.addEventListener("beforeunload", beforeUnload);
};
annotationStorage.onResetModified = function () {
annotationStorage.onResetModified = () => {
window.removeEventListener("beforeunload", beforeUnload);
};
},
@ -1729,17 +1744,14 @@ const PDFViewerApplication = {
}
},
cleanup() {
_cleanup() {
if (!this.pdfDocument) {
return;
}
this.pdfViewer.cleanup();
this.pdfThumbnailViewer.cleanup();
if (this.pdfViewer.renderer !== _ui_utils.RendererType.SVG) {
this.pdfDocument.cleanup();
}
this.pdfDocument.cleanup(this.pdfViewer.renderer === _ui_utils.RendererType.SVG);
},
forceRendering() {
@ -5339,7 +5351,7 @@ class PDFFindController {
this._pageDiffs = [];
this._matchesCountTotal = 0;
this._pagesToSearch = null;
this._pendingFindMatches = Object.create(null);
this._pendingFindMatches = new Set();
this._resumePageIdx = null;
this._dirtyMatch = false;
clearTimeout(this._findTimeout);
@ -5629,14 +5641,14 @@ class PDFFindController {
this._updateAllPages();
for (let i = 0; i < numPages; i++) {
if (this._pendingFindMatches[i] === true) {
if (this._pendingFindMatches.has(i)) {
continue;
}
this._pendingFindMatches[i] = true;
this._pendingFindMatches.add(i);
this._extractTextPromises[i].then(pageIdx => {
delete this._pendingFindMatches[pageIdx];
this._pendingFindMatches.delete(pageIdx);
this._calculateMatch(pageIdx);
});
@ -6790,11 +6802,6 @@ class PDFLinkService {
this.pdfViewer.pagesRotation = value;
}
navigateTo(dest) {
console.error("Deprecated method: `navigateTo`, use `goToDestination` instead.");
this.goToDestination(dest);
}
_goToDestinationHelper(rawDest, namedDest = null, explicitDest) {
const destRef = explicitDest[0];
let pageNumber;
@ -7223,6 +7230,10 @@ class PDFOutlineViewer extends _base_tree_viewer.BaseTreeViewer {
this.eventBus._on("pagesloaded", evt => {
this._isPagesLoaded = !!evt.pagesCount;
if (this._currentOutlineItemCapability && !this._currentOutlineItemCapability.settled) {
this._currentOutlineItemCapability.resolve(this._isPagesLoaded);
}
});
this.eventBus._on("sidebarviewchanged", evt => {
@ -7236,13 +7247,27 @@ class PDFOutlineViewer extends _base_tree_viewer.BaseTreeViewer {
this._pageNumberToDestHashCapability = null;
this._currentPageNumber = 1;
this._isPagesLoaded = false;
if (this._currentOutlineItemCapability && !this._currentOutlineItemCapability.settled) {
this._currentOutlineItemCapability.resolve(false);
}
this._currentOutlineItemCapability = null;
}
_dispatchEvent(outlineCount) {
this._currentOutlineItemCapability = (0, _pdfjsLib.createPromiseCapability)();
if (outlineCount === 0 || this._pdfDocument?.loadingParams.disableAutoFetch) {
this._currentOutlineItemCapability.resolve(false);
} else if (this._isPagesLoaded) {
this._currentOutlineItemCapability.resolve(true);
}
this.eventBus.dispatch("outlineloaded", {
source: this,
outlineCount,
enableCurrentOutlineItemButton: outlineCount > 0 && !this._pdfDocument?.loadingParams.disableAutoFetch
currentOutlineItemPromise: this._currentOutlineItemCapability.promise
});
}
@ -8635,12 +8660,13 @@ class PDFSidebar {
this.eventBus._on("outlineloaded", evt => {
onTreeLoaded(evt.outlineCount, this.outlineButton, _ui_utils.SidebarView.OUTLINE);
evt.currentOutlineItemPromise.then(enabled => {
if (!this.isInitialViewSet) {
return;
}
if (evt.enableCurrentOutlineItemButton) {
this.pdfViewer.pagesPromise.then(() => {
this._currentOutlineItemButton.disabled = !this.isInitialViewSet;
});
}
this._currentOutlineItemButton.disabled = !enabled;
});
});
this.eventBus._on("attachmentsloaded", evt => {
@ -9091,6 +9117,7 @@ var _pdfjsLib = __webpack_require__(5);
var _pdf_rendering_queue = __webpack_require__(8);
const DRAW_UPSCALE_FACTOR = 2;
const MAX_NUM_SCALING_STEPS = 3;
const THUMBNAIL_CANVAS_BORDER_WIDTH = 1;
const THUMBNAIL_WIDTH = 98;
@ -9116,7 +9143,7 @@ const TempImageFactory = function TempImageFactoryClosure() {
ctx.fillStyle = "rgb(255, 255, 255)";
ctx.fillRect(0, 0, width, height);
ctx.restore();
return tempCanvas;
return [tempCanvas, tempCanvas.getContext("2d")];
},
destroyCanvas() {
@ -9166,12 +9193,12 @@ class PDFThumbnailView {
};
this.disableCanvasToImageConversion = disableCanvasToImageConversion;
this.pageWidth = this.viewport.width;
this.pageHeight = this.viewport.height;
this.pageRatio = this.pageWidth / this.pageHeight;
const pageWidth = this.viewport.width,
pageHeight = this.viewport.height,
pageRatio = pageWidth / pageHeight;
this.canvasWidth = THUMBNAIL_WIDTH;
this.canvasHeight = this.canvasWidth / this.pageRatio | 0;
this.scale = this.canvasWidth / this.pageWidth;
this.canvasHeight = this.canvasWidth / pageRatio | 0;
this.scale = this.canvasWidth / pageWidth;
this.l10n = l10n;
const anchor = document.createElement("a");
anchor.href = linkService.getAnchorUrl("#page=" + id);
@ -9215,19 +9242,14 @@ class PDFThumbnailView {
reset() {
this.cancelRendering();
this.renderingState = _pdf_rendering_queue.RenderingStates.INITIAL;
this.pageWidth = this.viewport.width;
this.pageHeight = this.viewport.height;
this.pageRatio = this.pageWidth / this.pageHeight;
this.canvasHeight = this.canvasWidth / this.pageRatio | 0;
this.scale = this.canvasWidth / this.pageWidth;
const pageWidth = this.viewport.width,
pageHeight = this.viewport.height,
pageRatio = pageWidth / pageHeight;
this.canvasHeight = this.canvasWidth / pageRatio | 0;
this.scale = this.canvasWidth / pageWidth;
this.div.removeAttribute("data-loaded");
const ring = this.ring;
const childNodes = ring.childNodes;
for (let i = childNodes.length - 1; i >= 0; i--) {
ring.removeChild(childNodes[i]);
}
ring.textContent = "";
const borderAdjustment = 2 * THUMBNAIL_CANVAS_BORDER_WIDTH;
ring.style.width = this.canvasWidth + borderAdjustment + "px";
ring.style.height = this.canvasHeight + borderAdjustment + "px";
@ -9266,47 +9288,47 @@ class PDFThumbnailView {
this.resume = null;
}
_getPageDrawContext() {
_getPageDrawContext(upscaleFactor = 1) {
const canvas = document.createElement("canvas");
this.canvas = canvas;
canvas.mozOpaque = true;
const ctx = canvas.getContext("2d", {
alpha: false
});
const outputScale = (0, _ui_utils.getOutputScale)(ctx);
canvas.width = this.canvasWidth * outputScale.sx | 0;
canvas.height = this.canvasHeight * outputScale.sy | 0;
canvas.style.width = this.canvasWidth + "px";
canvas.style.height = this.canvasHeight + "px";
canvas.width = upscaleFactor * this.canvasWidth * outputScale.sx | 0;
canvas.height = upscaleFactor * this.canvasHeight * outputScale.sy | 0;
const transform = outputScale.scaled ? [outputScale.sx, 0, 0, outputScale.sy, 0, 0] : null;
return [ctx, transform];
return {
ctx,
canvas,
transform
};
}
_convertCanvasToImage() {
if (!this.canvas) {
return;
}
_convertCanvasToImage(canvas) {
if (this.renderingState !== _pdf_rendering_queue.RenderingStates.FINISHED) {
return;
throw new Error("_convertCanvasToImage: Rendering has not finished.");
}
const className = "thumbnailImage";
const reducedCanvas = this._reduceImage(canvas);
if (this.disableCanvasToImageConversion) {
this.canvas.className = className;
reducedCanvas.className = "thumbnailImage";
this._thumbPageCanvas.then(msg => {
this.canvas.setAttribute("aria-label", msg);
reducedCanvas.setAttribute("aria-label", msg);
});
reducedCanvas.style.width = this.canvasWidth + "px";
reducedCanvas.style.height = this.canvasHeight + "px";
this.canvas = reducedCanvas;
this.div.setAttribute("data-loaded", true);
this.ring.appendChild(this.canvas);
this.ring.appendChild(reducedCanvas);
return;
}
const image = document.createElement("img");
image.className = className;
image.className = "thumbnailImage";
this._thumbPageCanvas.then(msg => {
image.setAttribute("aria-label", msg);
@ -9314,13 +9336,12 @@ class PDFThumbnailView {
image.style.width = this.canvasWidth + "px";
image.style.height = this.canvasHeight + "px";
image.src = this.canvas.toDataURL();
image.src = reducedCanvas.toDataURL();
this.image = image;
this.div.setAttribute("data-loaded", true);
this.ring.appendChild(image);
this.canvas.width = 0;
this.canvas.height = 0;
delete this.canvas;
reducedCanvas.width = 0;
reducedCanvas.height = 0;
}
draw() {
@ -9351,17 +9372,21 @@ class PDFThumbnailView {
this.renderingState = _pdf_rendering_queue.RenderingStates.FINISHED;
this._convertCanvasToImage();
this._convertCanvasToImage(canvas);
if (error) {
throw error;
}
};
const [ctx, transform] = this._getPageDrawContext();
const {
ctx,
canvas,
transform
} = this._getPageDrawContext(DRAW_UPSCALE_FACTOR);
const drawViewport = this.viewport.clone({
scale: this.scale
scale: DRAW_UPSCALE_FACTOR * this.scale
});
const renderContinueCallback = cont => {
@ -9388,18 +9413,18 @@ class PDFThumbnailView {
const renderTask = this.renderTask = pdfPage.render(renderContext);
renderTask.onContinue = renderContinueCallback;
const resultPromise = renderTask.promise.then(function () {
finishRenderTask(null);
return finishRenderTask(null);
}, function (error) {
finishRenderTask(error);
return finishRenderTask(error);
});
resultPromise.finally(() => {
canvas.width = 0;
canvas.height = 0;
const pageCached = this.linkService.isPageCached(this.id);
if (pageCached) {
return;
if (!pageCached) {
this.pdfPage?.cleanup();
}
this.pdfPage?.cleanup();
});
return resultPromise;
}
@ -9413,34 +9438,38 @@ class PDFThumbnailView {
return;
}
const img = pageView.canvas;
const {
canvas,
pdfPage
} = pageView;
if (!img) {
if (!canvas) {
return;
}
if (!this.pdfPage) {
this.setPdfPage(pageView.pdfPage);
this.setPdfPage(pdfPage);
}
this.renderingState = _pdf_rendering_queue.RenderingStates.FINISHED;
const [ctx] = this._getPageDrawContext();
this._convertCanvasToImage(canvas);
}
const canvas = ctx.canvas;
_reduceImage(img) {
const {
ctx,
canvas
} = this._getPageDrawContext();
if (img.width <= 2 * canvas.width) {
ctx.drawImage(img, 0, 0, img.width, img.height, 0, 0, canvas.width, canvas.height);
this._convertCanvasToImage();
return;
return canvas;
}
let reducedWidth = canvas.width << MAX_NUM_SCALING_STEPS;
let reducedHeight = canvas.height << MAX_NUM_SCALING_STEPS;
const reducedImage = TempImageFactory.getCanvas(reducedWidth, reducedHeight);
const reducedImageCtx = reducedImage.getContext("2d");
const [reducedImage, reducedImageCtx] = TempImageFactory.getCanvas(reducedWidth, reducedHeight);
while (reducedWidth > img.width || reducedHeight > img.height) {
reducedWidth >>= 1;
@ -9456,8 +9485,7 @@ class PDFThumbnailView {
}
ctx.drawImage(reducedImage, 0, 0, reducedWidth, reducedHeight, 0, 0, canvas.width, canvas.height);
this._convertCanvasToImage();
return canvas;
}
get _thumbPageTitle() {
@ -9486,7 +9514,7 @@ class PDFThumbnailView {
this._thumbPageCanvas.then(msg => {
if (this.image) {
this.image.setAttribute("aria-label", msg);
} else if (this.disableCanvasToImageConversion && this.canvas) {
} else if (this.canvas) {
this.canvas.setAttribute("aria-label", msg);
}
});
@ -9609,9 +9637,11 @@ var _pdf_page_view = __webpack_require__(31);
var _pdf_link_service = __webpack_require__(19);
var _text_layer_builder = __webpack_require__(32);
var _struct_tree_layer_builder = __webpack_require__(32);
var _xfa_layer_builder = __webpack_require__(33);
var _text_layer_builder = __webpack_require__(33);
var _xfa_layer_builder = __webpack_require__(34);
const DEFAULT_CACHE_SIZE = 10;
@ -9675,7 +9705,7 @@ class BaseViewer {
throw new Error("Cannot initialize BaseViewer.");
}
const viewerVersion = '2.8.320';
const viewerVersion = '2.9.44';
if (_pdfjsLib.version !== viewerVersion) {
throw new Error(`The API version "${_pdfjsLib.version}" does not match the Viewer version "${viewerVersion}".`);
@ -10000,14 +10030,14 @@ class BaseViewer {
textLayerMode: this.textLayerMode,
annotationLayerFactory: this,
xfaLayerFactory,
structTreeLayerFactory: this,
imageResourcesPath: this.imageResourcesPath,
renderInteractiveForms: this.renderInteractiveForms,
renderer: this.renderer,
enableWebGL: this.enableWebGL,
useOnlyCssZoom: this.useOnlyCssZoom,
maxCanvasPixels: this.maxCanvasPixels,
l10n: this.l10n,
enableScripting: this.enableScripting
l10n: this.l10n
});
this._pages.push(pageView);
@ -10635,7 +10665,7 @@ class BaseViewer {
});
}
createAnnotationLayerBuilder(pageDiv, pdfPage, annotationStorage = null, imageResourcesPath = "", renderInteractiveForms = false, l10n = _l10n_utils.NullL10n, enableScripting = false, hasJSActionsPromise = null, mouseState = null) {
createAnnotationLayerBuilder(pageDiv, pdfPage, annotationStorage = null, imageResourcesPath = "", renderInteractiveForms = false, l10n = _l10n_utils.NullL10n, enableScripting = null, hasJSActionsPromise = null, mouseState = null) {
return new _annotation_layer_builder.AnnotationLayerBuilder({
pageDiv,
pdfPage,
@ -10645,7 +10675,7 @@ class BaseViewer {
linkService: this.linkService,
downloadManager: this.downloadManager,
l10n,
enableScripting,
enableScripting: enableScripting ?? this.enableScripting,
hasJSActionsPromise: hasJSActionsPromise || this.pdfDocument?.hasJSActions(),
mouseState: mouseState || this._scriptingManager?.mouseState
});
@ -10658,6 +10688,12 @@ class BaseViewer {
});
}
createStructTreeLayerBuilder(pdfPage) {
return new _struct_tree_layer_builder.StructTreeLayerBuilder({
pdfPage
});
}
get hasEqualPageSizes() {
const firstPageView = this._pages[0];
@ -11187,7 +11223,8 @@ const DEFAULT_L10N_STRINGS = {
unexpected_response_error: "Unexpected server response.",
printing_not_supported: "Warning: Printing is not fully supported by this browser.",
printing_not_ready: "Warning: The PDF is not fully loaded for printing.",
web_fonts_disabled: "Web fonts are disabled: unable to use embedded PDF fonts."
web_fonts_disabled: "Web fonts are disabled: unable to use embedded PDF fonts.",
unsupported_feature_signatures: "This PDF document contains digital signatures. Validation of signatures is not supported."
};
function getL10nFallback(key, args) {
@ -11279,10 +11316,10 @@ class PDFPageView {
this.textLayerFactory = options.textLayerFactory;
this.annotationLayerFactory = options.annotationLayerFactory;
this.xfaLayerFactory = options.xfaLayerFactory;
this.structTreeLayerFactory = options.structTreeLayerFactory;
this.renderer = options.renderer || _ui_utils.RendererType.CANVAS;
this.enableWebGL = options.enableWebGL || false;
this.l10n = options.l10n || _l10n_utils.NullL10n;
this.enableScripting = options.enableScripting === true;
this.paintTask = null;
this.paintedViewportMap = new WeakMap();
this.renderingState = _pdf_rendering_queue.RenderingStates.INITIAL;
@ -11292,6 +11329,7 @@ class PDFPageView {
this.textLayer = null;
this.zoomLayer = null;
this.xfaLayer = null;
this.structTreeLayer = null;
const div = document.createElement("div");
div.className = "page";
div.style.width = Math.floor(this.viewport.width) + "px";
@ -11512,6 +11550,12 @@ class PDFPageView {
this.annotationLayer.cancel();
this.annotationLayer = null;
}
if (this._onTextLayerRendered) {
this.eventBus._off("textlayerrendered", this._onTextLayerRendered);
this._onTextLayerRendered = null;
}
}
cssTransform(target, redrawAnnotations = false) {
@ -11702,11 +11746,12 @@ class PDFPageView {
const paintTask = this.renderer === _ui_utils.RendererType.SVG ? this.paintOnSvg(canvasWrapper) : this.paintOnCanvas(canvasWrapper);
paintTask.onRenderContinue = renderContinueCallback;
this.paintTask = paintTask;
const resultPromise = paintTask.promise.then(function () {
return finishPaintTask(null).then(function () {
const resultPromise = paintTask.promise.then(() => {
return finishPaintTask(null).then(() => {
if (textLayer) {
const readableStream = pdfPage.streamTextContent({
normalizeWhitespace: true
normalizeWhitespace: true,
includeMarkedContent: true
});
textLayer.setTextContentStream(readableStream);
textLayer.render();
@ -11718,7 +11763,7 @@ class PDFPageView {
if (this.annotationLayerFactory) {
if (!this.annotationLayer) {
this.annotationLayer = this.annotationLayerFactory.createAnnotationLayerBuilder(div, pdfPage, null, this.imageResourcesPath, this.renderInteractiveForms, this.l10n, this.enableScripting, null, null);
this.annotationLayer = this.annotationLayerFactory.createAnnotationLayerBuilder(div, pdfPage, null, this.imageResourcesPath, this.renderInteractiveForms, this.l10n, null, null, null);
}
this._renderAnnotationLayer();
@ -11732,6 +11777,31 @@ class PDFPageView {
this._renderXfaLayer();
}
if (this.structTreeLayerFactory && this.textLayer && this.canvas) {
this._onTextLayerRendered = event => {
if (event.pageNumber !== this.id) {
return;
}
this.eventBus._off("textlayerrendered", this._onTextLayerRendered);
this._onTextLayerRendered = null;
this.pdfPage.getStructTree().then(tree => {
if (!tree) {
return;
}
const treeDom = this.structTreeLayer.render(tree);
treeDom.classList.add("structTree");
this.canvas.appendChild(treeDom);
});
};
this.eventBus._on("textlayerrendered", this._onTextLayerRendered);
this.structTreeLayer = this.structTreeLayerFactory.createStructTreeLayerBuilder(pdfPage);
}
div.setAttribute("data-loaded", true);
this.eventBus.dispatch("pagerender", {
source: this,
@ -11863,6 +11933,132 @@ exports.PDFPageView = PDFPageView;
/***/ }),
/* 32 */
/***/ ((__unused_webpack_module, exports) => {
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.StructTreeLayerBuilder = exports.DefaultStructTreeLayerFactory = void 0;
const PDF_ROLE_TO_HTML_ROLE = {
Document: null,
DocumentFragment: null,
Part: "group",
Sect: "group",
Div: "group",
Aside: "note",
NonStruct: "none",
P: null,
H: "heading",
Title: null,
FENote: "note",
Sub: "group",
Lbl: null,
Span: null,
Em: null,
Strong: null,
Link: "link",
Annot: "note",
Form: "form",
Ruby: null,
RB: null,
RT: null,
RP: null,
Warichu: null,
WT: null,
WP: null,
L: "list",
LI: "listitem",
LBody: null,
Table: "table",
TR: "row",
TH: "columnheader",
TD: "cell",
THead: "columnheader",
TBody: null,
TFoot: null,
Caption: null,
Figure: "figure",
Formula: null,
Artifact: null
};
const HEADING_PATTERN = /^H(\d+)$/;
class StructTreeLayerBuilder {
constructor({
pdfPage
}) {
this.pdfPage = pdfPage;
}
render(structTree) {
return this._walk(structTree);
}
_setAttributes(structElement, htmlElement) {
if (structElement.alt !== undefined) {
htmlElement.setAttribute("aria-label", structElement.alt);
}
if (structElement.id !== undefined) {
htmlElement.setAttribute("aria-owns", structElement.id);
}
}
_walk(node) {
if (!node) {
return null;
}
const element = document.createElement("span");
if ("role" in node) {
const {
role
} = node;
const match = role.match(HEADING_PATTERN);
if (match) {
element.setAttribute("role", "heading");
element.setAttribute("aria-level", match[1]);
} else if (PDF_ROLE_TO_HTML_ROLE[role]) {
element.setAttribute("role", PDF_ROLE_TO_HTML_ROLE[role]);
}
}
this._setAttributes(node, element);
if (node.children) {
if (node.children.length === 1 && "id" in node.children[0]) {
this._setAttributes(node.children[0], element);
} else {
for (const kid of node.children) {
element.appendChild(this._walk(kid));
}
}
}
return element;
}
}
exports.StructTreeLayerBuilder = StructTreeLayerBuilder;
class DefaultStructTreeLayerFactory {
createStructTreeLayerBuilder(pdfPage) {
return new StructTreeLayerBuilder({
pdfPage
});
}
}
exports.DefaultStructTreeLayerFactory = DefaultStructTreeLayerFactory;
/***/ }),
/* 33 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
@ -12216,7 +12412,7 @@ class DefaultTextLayerFactory {
exports.DefaultTextLayerFactory = DefaultTextLayerFactory;
/***/ }),
/* 33 */
/* 34 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
@ -12295,7 +12491,7 @@ class DefaultXfaLayerFactory {
exports.DefaultXfaLayerFactory = DefaultXfaLayerFactory;
/***/ }),
/* 34 */
/* 35 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
@ -12309,7 +12505,7 @@ var _ui_utils = __webpack_require__(4);
var _pdf_cursor_tools = __webpack_require__(6);
var _pdf_single_page_viewer = __webpack_require__(35);
var _pdf_single_page_viewer = __webpack_require__(36);
class SecondaryToolbar {
constructor(options, mainContainer, eventBus) {
@ -12614,7 +12810,7 @@ class SecondaryToolbar {
exports.SecondaryToolbar = SecondaryToolbar;
/***/ }),
/* 35 */
/* 36 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
@ -12743,7 +12939,7 @@ class PDFSinglePageViewer extends _base_viewer.BaseViewer {
exports.PDFSinglePageViewer = PDFSinglePageViewer;
/***/ }),
/* 36 */
/* 37 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
@ -13011,7 +13207,7 @@ class Toolbar {
exports.Toolbar = Toolbar;
/***/ }),
/* 37 */
/* 38 */
/***/ ((__unused_webpack_module, exports) => {
@ -13106,7 +13302,7 @@ class ViewHistory {
exports.ViewHistory = ViewHistory;
/***/ }),
/* 38 */
/* 39 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
@ -13116,13 +13312,13 @@ Object.defineProperty(exports, "__esModule", ({
}));
exports.FirefoxCom = exports.DownloadManager = void 0;
__webpack_require__(39);
__webpack_require__(40);
var _app = __webpack_require__(3);
var _pdfjsLib = __webpack_require__(5);
var _preferences = __webpack_require__(40);
var _preferences = __webpack_require__(41);
var _ui_utils = __webpack_require__(4);
@ -13530,7 +13726,7 @@ document.mozL10n.setExternalLocalizerServices({
});
/***/ }),
/* 39 */
/* 40 */
/***/ (() => {
@ -13652,7 +13848,7 @@ document.mozL10n.setExternalLocalizerServices({
})(void 0);
/***/ }),
/* 40 */
/* 41 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
@ -13785,7 +13981,7 @@ class BasePreferences {
exports.BasePreferences = BasePreferences;
/***/ }),
/* 41 */
/* 42 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
@ -13830,7 +14026,7 @@ function composePage(pdfDocument, pageNumber, size, printContainer, printResolut
rotation: size.rotation
}),
intent: "print",
annotationStorage: pdfDocument.annotationStorage,
includeAnnotationStorage: true,
optionalContentConfigPromise
};
currentRenderTask = thisRenderTask = pdfPage.render(renderContext);
@ -13959,15 +14155,15 @@ var _app_options = __webpack_require__(1);
var _app = __webpack_require__(3);
const pdfjsVersion = '2.8.320';
const pdfjsBuild = 'ca7f54682';
const pdfjsVersion = '2.9.44';
const pdfjsBuild = '6cf307000';
window.PDFViewerApplication = _app.PDFViewerApplication;
window.PDFViewerApplicationOptions = _app_options.AppOptions;
;
{
__webpack_require__(38);
__webpack_require__(39);
__webpack_require__(41);
__webpack_require__(42);
}
;
;

Просмотреть файл

@ -20,7 +20,7 @@ origin:
# Human-readable identifier for this version/release
# Generally "version NNN", "tag SSS", "bookmark SSS"
release: version 2.8.320
release: version 2.9.44
# The package's license, where possible using the mnemonic from
# https://spdx.org/licenses/