forked from mirrors/gecko-dev
Bug 1881422 - Update PDF.js to 72b8b29147c3a19ccacc9db111df4925efcbe1bf r=pdfjs-reviewers,calixte
Differential Revision: https://phabricator.services.mozilla.com/D202382
This commit is contained in:
parent
35824cf6dd
commit
31f84e20ac
9 changed files with 181 additions and 64 deletions
|
|
@ -25,6 +25,7 @@ export const PdfJsDefaultPreferences = Object.freeze({
|
|||
defaultZoomValue: "",
|
||||
disablePageLabels: false,
|
||||
enableHighlightEditor: false,
|
||||
enableML: false,
|
||||
enablePermissions: false,
|
||||
enablePrintAutoRotate: true,
|
||||
enableScripting: true,
|
||||
|
|
|
|||
|
|
@ -1940,6 +1940,7 @@ class AnnotationEditorUIManager {
|
|||
#isWaiting = false;
|
||||
#lastActiveElement = null;
|
||||
#mainHighlightColorPicker = null;
|
||||
#mlManager = null;
|
||||
#mode = AnnotationEditorType.NONE;
|
||||
#selectedEditors = new Set();
|
||||
#pageColors = null;
|
||||
|
|
@ -2023,7 +2024,7 @@ class AnnotationEditorUIManager {
|
|||
checker: arrowChecker
|
||||
}]]));
|
||||
}
|
||||
constructor(container, viewer, altTextManager, eventBus, pdfDocument, pageColors, highlightColors) {
|
||||
constructor(container, viewer, altTextManager, eventBus, pdfDocument, pageColors, highlightColors, mlManager) {
|
||||
this.#container = container;
|
||||
this.#viewer = viewer;
|
||||
this.#altTextManager = altTextManager;
|
||||
|
|
@ -2036,6 +2037,7 @@ class AnnotationEditorUIManager {
|
|||
this.#filterFactory = pdfDocument.filterFactory;
|
||||
this.#pageColors = pageColors;
|
||||
this.#highlightColors = highlightColors || null;
|
||||
this.#mlManager = mlManager || null;
|
||||
this.viewParameters = {
|
||||
realScale: PixelsPerInch.PDF_TO_CSS_UNITS,
|
||||
rotation: 0
|
||||
|
|
@ -2068,6 +2070,12 @@ class AnnotationEditorUIManager {
|
|||
this.#translationTimeoutId = null;
|
||||
}
|
||||
}
|
||||
async mlGuess(data) {
|
||||
return this.#mlManager?.guess(data) || null;
|
||||
}
|
||||
get hasMLManager() {
|
||||
return !!this.#mlManager;
|
||||
}
|
||||
get hcmFilter() {
|
||||
return shadow(this, "hcmFilter", this.#pageColors ? this.#filterFactory.addHCMFilter(this.#pageColors.foreground, this.#pageColors.background) : "none");
|
||||
}
|
||||
|
|
@ -2883,6 +2891,9 @@ class AltText {
|
|||
});
|
||||
this.#altTextWasFromKeyBoard = false;
|
||||
}
|
||||
isEmpty() {
|
||||
return !this.#altText && !this.#altTextDecorative;
|
||||
}
|
||||
get data() {
|
||||
return {
|
||||
altText: this.#altText,
|
||||
|
|
@ -3690,6 +3701,9 @@ class AnnotationEditor {
|
|||
}
|
||||
this.#altText.data = data;
|
||||
}
|
||||
hasAltText() {
|
||||
return !this.#altText?.isEmpty();
|
||||
}
|
||||
render() {
|
||||
this.div = document.createElement("div");
|
||||
this.div.setAttribute("data-editor-rotation", (360 - this.rotation) % 360);
|
||||
|
|
@ -4023,7 +4037,9 @@ class AnnotationEditor {
|
|||
this.#resizersDiv?.classList.add("hidden");
|
||||
this.div?.classList.remove("selectedEditor");
|
||||
if (this.div?.contains(document.activeElement)) {
|
||||
this._uiManager.currentLayer.div.focus();
|
||||
this._uiManager.currentLayer.div.focus({
|
||||
preventScroll: true
|
||||
});
|
||||
}
|
||||
this.#editToolbar?.hide();
|
||||
}
|
||||
|
|
@ -8170,7 +8186,7 @@ class OptionalContentConfig {
|
|||
return true;
|
||||
}
|
||||
if (!group) {
|
||||
warn("Optional content group not defined.");
|
||||
info("Optional content group not defined.");
|
||||
return true;
|
||||
}
|
||||
if (group.type === "OCG") {
|
||||
|
|
@ -8681,7 +8697,7 @@ function getDocument(src) {
|
|||
}
|
||||
const fetchDocParams = {
|
||||
docId,
|
||||
apiVersion: "4.1.181",
|
||||
apiVersion: "4.1.215",
|
||||
data,
|
||||
password,
|
||||
disableAutoFetch,
|
||||
|
|
@ -9545,7 +9561,7 @@ class PDFWorker {
|
|||
if (this.#mainThreadWorkerMessageHandler) {
|
||||
return this.#mainThreadWorkerMessageHandler;
|
||||
}
|
||||
const worker = await import(/* webpackIgnore: true */ this.workerSrc);
|
||||
const worker = await import( /*webpackIgnore: true*/this.workerSrc);
|
||||
return worker.WorkerMessageHandler;
|
||||
};
|
||||
return shadow(this, "_setupFakeWorkerGlobal", loader());
|
||||
|
|
@ -10313,8 +10329,8 @@ class InternalRenderTask {
|
|||
}
|
||||
}
|
||||
}
|
||||
const version = "4.1.181";
|
||||
const build = "14874e50b";
|
||||
const version = "4.1.215";
|
||||
const build = "72b8b2914";
|
||||
|
||||
;// CONCATENATED MODULE: ./src/shared/scripting_utils.js
|
||||
function makeColorComp(n) {
|
||||
|
|
@ -15877,6 +15893,32 @@ class StampEditor extends AnnotationEditor {
|
|||
canvas.width = width;
|
||||
canvas.height = height;
|
||||
const bitmap = this.#isSvg ? this.#bitmap : this.#scaleBitmap(width, height);
|
||||
if (this._uiManager.hasMLManager && !this.hasAltText()) {
|
||||
const offscreen = new OffscreenCanvas(width, height);
|
||||
const ctx = offscreen.getContext("2d");
|
||||
ctx.drawImage(bitmap, 0, 0, bitmap.width, bitmap.height, 0, 0, width, height);
|
||||
offscreen.convertToBlob().then(blob => {
|
||||
const fileReader = new FileReader();
|
||||
fileReader.onload = () => {
|
||||
const url = fileReader.result;
|
||||
this._uiManager.mlGuess({
|
||||
service: "image-to-text",
|
||||
request: {
|
||||
imageData: url
|
||||
}
|
||||
}).then(response => {
|
||||
const altText = response?.output || "";
|
||||
if (this.parent && altText && !this.hasAltText()) {
|
||||
this.altTextData = {
|
||||
altText,
|
||||
decorative: false
|
||||
};
|
||||
}
|
||||
});
|
||||
};
|
||||
fileReader.readAsDataURL(blob);
|
||||
});
|
||||
}
|
||||
const ctx = canvas.getContext("2d");
|
||||
ctx.filter = this._uiManager.hcmFilter;
|
||||
ctx.drawImage(bitmap, 0, 0, bitmap.width, bitmap.height, 0, 0, width, height);
|
||||
|
|
@ -16065,8 +16107,9 @@ class AnnotationEditorLayer {
|
|||
case AnnotationEditorType.NONE:
|
||||
this.disableTextSelection();
|
||||
this.togglePointerEvents(false);
|
||||
this.toggleAnnotationLayerPointerEvents(true);
|
||||
this.disableClick();
|
||||
break;
|
||||
return;
|
||||
case AnnotationEditorType.INK:
|
||||
this.addInkEditorIfNeeded(false);
|
||||
this.disableTextSelection();
|
||||
|
|
@ -16083,15 +16126,14 @@ class AnnotationEditorLayer {
|
|||
this.togglePointerEvents(true);
|
||||
this.enableClick();
|
||||
}
|
||||
if (mode !== AnnotationEditorType.NONE) {
|
||||
const {
|
||||
classList
|
||||
} = this.div;
|
||||
for (const editorType of AnnotationEditorLayer.#editorTypes.values()) {
|
||||
classList.toggle(`${editorType._type}Editing`, mode === editorType._editorType);
|
||||
}
|
||||
this.div.hidden = false;
|
||||
this.toggleAnnotationLayerPointerEvents(false);
|
||||
const {
|
||||
classList
|
||||
} = this.div;
|
||||
for (const editorType of AnnotationEditorLayer.#editorTypes.values()) {
|
||||
classList.toggle(`${editorType._type}Editing`, mode === editorType._editorType);
|
||||
}
|
||||
this.div.hidden = false;
|
||||
}
|
||||
addInkEditorIfNeeded(isCommitting) {
|
||||
if (this.#uiManager.getMode() !== AnnotationEditorType.INK) {
|
||||
|
|
@ -16120,6 +16162,9 @@ class AnnotationEditorLayer {
|
|||
togglePointerEvents(enabled = false) {
|
||||
this.div.classList.toggle("disabled", !enabled);
|
||||
}
|
||||
toggleAnnotationLayerPointerEvents(enabled = false) {
|
||||
this.#annotationLayer?.div.classList.toggle("disabled", !enabled);
|
||||
}
|
||||
enable() {
|
||||
this.togglePointerEvents(true);
|
||||
const annotationElementIds = new Set();
|
||||
|
|
@ -16185,6 +16230,7 @@ class AnnotationEditorLayer {
|
|||
classList.remove(`${editorType._type}Editing`);
|
||||
}
|
||||
this.disableTextSelection();
|
||||
this.toggleAnnotationLayerPointerEvents(true);
|
||||
this.#isDisabling = false;
|
||||
}
|
||||
getEditableAnnotation(id) {
|
||||
|
|
@ -16842,8 +16888,8 @@ class DrawLayer {
|
|||
|
||||
|
||||
|
||||
const pdfjsVersion = "4.1.181";
|
||||
const pdfjsBuild = "14874e50b";
|
||||
const pdfjsVersion = "4.1.215";
|
||||
const pdfjsBuild = "72b8b2914";
|
||||
|
||||
var __webpack_exports__AbortException = __webpack_exports__.AbortException;
|
||||
var __webpack_exports__AnnotationEditorLayer = __webpack_exports__.AnnotationEditorLayer;
|
||||
|
|
|
|||
|
|
@ -3957,8 +3957,8 @@ function initSandbox(params) {
|
|||
|
||||
;// CONCATENATED MODULE: ./src/pdf.scripting.js
|
||||
|
||||
const pdfjsVersion = "4.1.181";
|
||||
const pdfjsBuild = "14874e50b";
|
||||
const pdfjsVersion = "4.1.215";
|
||||
const pdfjsBuild = "72b8b2914";
|
||||
globalThis.pdfjsScripting = {
|
||||
initSandbox: initSandbox
|
||||
};
|
||||
|
|
|
|||
|
|
@ -25295,6 +25295,10 @@ class Font {
|
|||
locaEntries[i].endOffset = nextOffset;
|
||||
break;
|
||||
}
|
||||
const last = locaEntries.at(-2);
|
||||
if (last.offset !== 0 && last.endOffset === 0) {
|
||||
last.endOffset = oldGlyfDataLength;
|
||||
}
|
||||
const missingGlyphs = Object.create(null);
|
||||
let writeOffset = 0;
|
||||
itemEncode(locaData, 0, writeOffset);
|
||||
|
|
@ -32446,6 +32450,7 @@ class PartialEvaluator {
|
|||
case OPS.beginMarkedContentProps:
|
||||
if (!(args[0] instanceof Name)) {
|
||||
warn(`Expected name for beginMarkedContentProps arg0=${args[0]}`);
|
||||
operatorList.addOp(OPS.beginMarkedContentProps, ["OC", null]);
|
||||
continue;
|
||||
}
|
||||
if (args[0].name === "OC") {
|
||||
|
|
@ -32457,6 +32462,7 @@ class PartialEvaluator {
|
|||
}
|
||||
if (self.options.ignoreErrors) {
|
||||
warn(`getOperatorList - ignoring beginMarkedContentProps: "${reason}".`);
|
||||
operatorList.addOp(OPS.beginMarkedContentProps, ["OC", null]);
|
||||
return;
|
||||
}
|
||||
throw reason;
|
||||
|
|
@ -33503,7 +33509,7 @@ class PartialEvaluator {
|
|||
if (!properties.composite) {
|
||||
return new ToUnicodeMap(this._simpleFontToUnicode(properties));
|
||||
}
|
||||
if (properties.composite && (properties.cMap.builtInCMap && !(properties.cMap instanceof IdentityCMap) || properties.cidSystemInfo.registry === "Adobe" && (properties.cidSystemInfo.ordering === "GB1" || properties.cidSystemInfo.ordering === "CNS1" || properties.cidSystemInfo.ordering === "Japan1" || properties.cidSystemInfo.ordering === "Korea1"))) {
|
||||
if (properties.composite && (properties.cMap.builtInCMap && !(properties.cMap instanceof IdentityCMap) || properties.cidSystemInfo?.registry === "Adobe" && (properties.cidSystemInfo.ordering === "GB1" || properties.cidSystemInfo.ordering === "CNS1" || properties.cidSystemInfo.ordering === "Japan1" || properties.cidSystemInfo.ordering === "Korea1"))) {
|
||||
const {
|
||||
registry,
|
||||
ordering
|
||||
|
|
@ -56652,7 +56658,7 @@ class WorkerMessageHandler {
|
|||
docId,
|
||||
apiVersion
|
||||
} = docParams;
|
||||
const workerVersion = "4.1.181";
|
||||
const workerVersion = "4.1.215";
|
||||
if (apiVersion !== workerVersion) {
|
||||
throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
|
||||
}
|
||||
|
|
@ -57214,8 +57220,8 @@ if (typeof window === "undefined" && !isNodeJS && typeof self !== "undefined" &&
|
|||
|
||||
;// CONCATENATED MODULE: ./src/pdf.worker.js
|
||||
|
||||
const pdfjsVersion = "4.1.181";
|
||||
const pdfjsBuild = "14874e50b";
|
||||
const pdfjsVersion = "4.1.215";
|
||||
const pdfjsBuild = "72b8b2914";
|
||||
|
||||
var __webpack_exports__WorkerMessageHandler = __webpack_exports__.WorkerMessageHandler;
|
||||
export { __webpack_exports__WorkerMessageHandler as WorkerMessageHandler };
|
||||
|
|
|
|||
|
|
@ -174,6 +174,13 @@
|
|||
transform:rotate(90deg) translateY(-100%);
|
||||
}
|
||||
|
||||
&.disabled{
|
||||
section,
|
||||
.popup{
|
||||
pointer-events:none;
|
||||
}
|
||||
}
|
||||
|
||||
canvas{
|
||||
position:absolute;
|
||||
width:100%;
|
||||
|
|
|
|||
|
|
@ -606,6 +606,10 @@ const defaultOptions = {
|
|||
value: false,
|
||||
kind: OptionKind.VIEWER + OptionKind.PREFERENCE
|
||||
},
|
||||
enableML: {
|
||||
value: false,
|
||||
kind: OptionKind.VIEWER + OptionKind.PREFERENCE
|
||||
},
|
||||
enablePermissions: {
|
||||
value: false,
|
||||
kind: OptionKind.VIEWER + OptionKind.PREFERENCE
|
||||
|
|
@ -1444,6 +1448,7 @@ class BasePreferences {
|
|||
defaultZoomValue: "",
|
||||
disablePageLabels: false,
|
||||
enableHighlightEditor: false,
|
||||
enableML: false,
|
||||
enablePermissions: false,
|
||||
enablePrintAutoRotate: true,
|
||||
enableScripting: true,
|
||||
|
|
@ -1843,6 +1848,11 @@ class FirefoxScripting {
|
|||
FirefoxCom.request("destroySandbox", null);
|
||||
}
|
||||
}
|
||||
class MLManager {
|
||||
guess(data) {
|
||||
return FirefoxCom.requestAsync("mlGuess", data);
|
||||
}
|
||||
}
|
||||
class ExternalServices extends BaseExternalServices {
|
||||
updateFindControlState(data) {
|
||||
FirefoxCom.request("updateFindControlState", data);
|
||||
|
|
@ -3636,7 +3646,14 @@ function composePage(pdfDocument, pageNumber, size, printContainer, printResolut
|
|||
};
|
||||
}
|
||||
class FirefoxPrintService {
|
||||
constructor(pdfDocument, pagesOverview, printContainer, printResolution, optionalContentConfigPromise = null, printAnnotationStoragePromise = null) {
|
||||
constructor({
|
||||
pdfDocument,
|
||||
pagesOverview,
|
||||
printContainer,
|
||||
printResolution,
|
||||
optionalContentConfigPromise = null,
|
||||
printAnnotationStoragePromise = null
|
||||
}) {
|
||||
this.pdfDocument = pdfDocument;
|
||||
this.pagesOverview = pagesOverview;
|
||||
this.printContainer = printContainer;
|
||||
|
|
@ -3689,8 +3706,8 @@ class PDFPrintServiceFactory {
|
|||
const canvas = document.createElement("canvas");
|
||||
return shadow(this, "supportsPrinting", "mozPrintCallback" in canvas);
|
||||
}
|
||||
static createPrintService(pdfDocument, pagesOverview, printContainer, printResolution, optionalContentConfigPromise, printAnnotationStoragePromise) {
|
||||
return new FirefoxPrintService(pdfDocument, pagesOverview, printContainer, printResolution, optionalContentConfigPromise, printAnnotationStoragePromise);
|
||||
static createPrintService(params) {
|
||||
return new FirefoxPrintService(params);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -5847,6 +5864,7 @@ class PDFViewer {
|
|||
#containerTopLeft = null;
|
||||
#copyCallbackBound = null;
|
||||
#enablePermissions = false;
|
||||
#mlManager = null;
|
||||
#getAllTextInProgress = false;
|
||||
#hiddenCopyElement = null;
|
||||
#interruptCopyCondition = false;
|
||||
|
|
@ -5857,7 +5875,7 @@ class PDFViewer {
|
|||
#scaleTimeoutId = null;
|
||||
#textLayerMode = TextLayerMode.ENABLE;
|
||||
constructor(options) {
|
||||
const viewerVersion = "4.1.181";
|
||||
const viewerVersion = "4.1.215";
|
||||
if (version !== viewerVersion) {
|
||||
throw new Error(`The API version "${version}" does not match the Viewer version "${viewerVersion}".`);
|
||||
}
|
||||
|
|
@ -5883,6 +5901,7 @@ class PDFViewer {
|
|||
this.l10n = options.l10n;
|
||||
this.#enablePermissions = options.enablePermissions || false;
|
||||
this.pageColors = options.pageColors || null;
|
||||
this.#mlManager = options.mlManager || null;
|
||||
this.defaultRenderingQueue = !options.renderingQueue;
|
||||
this.renderingQueue = options.renderingQueue;
|
||||
this.scroll = watchScroll(this.container, this._scrollUpdate.bind(this));
|
||||
|
|
@ -6242,7 +6261,7 @@ class PDFViewer {
|
|||
if (pdfDocument.isPureXfa) {
|
||||
console.warn("Warning: XFA-editing is not implemented.");
|
||||
} else if (isValidAnnotationEditorMode(mode)) {
|
||||
this.#annotationEditorUIManager = new AnnotationEditorUIManager(this.container, this.viewer, this.#altTextManager, this.eventBus, pdfDocument, this.pageColors, this.#annotationEditorHighlightColors);
|
||||
this.#annotationEditorUIManager = new AnnotationEditorUIManager(this.container, this.viewer, this.#altTextManager, this.eventBus, pdfDocument, this.pageColors, this.#annotationEditorHighlightColors, this.#mlManager);
|
||||
this.eventBus.dispatch("annotationeditoruimanager", {
|
||||
source: this,
|
||||
uiManager: this.#annotationEditorUIManager
|
||||
|
|
@ -7607,7 +7626,8 @@ const PDFViewerApplication = {
|
|||
enablePrintAutoRotate: AppOptions.get("enablePrintAutoRotate"),
|
||||
maxCanvasPixels: AppOptions.get("maxCanvasPixels"),
|
||||
enablePermissions: AppOptions.get("enablePermissions"),
|
||||
pageColors
|
||||
pageColors,
|
||||
mlManager: this.mlManager
|
||||
});
|
||||
this.pdfViewer = pdfViewer;
|
||||
pdfRenderingQueue.setViewer(pdfViewer);
|
||||
|
|
@ -7746,6 +7766,9 @@ const PDFViewerApplication = {
|
|||
get externalServices() {
|
||||
return shadow(this, "externalServices", new ExternalServices());
|
||||
},
|
||||
get mlManager() {
|
||||
return shadow(this, "mlManager", AppOptions.get("enableML") === true ? new MLManager() : null);
|
||||
},
|
||||
get initialized() {
|
||||
return this._initializedCapability.settled;
|
||||
},
|
||||
|
|
@ -8460,15 +8483,17 @@ const PDFViewerApplication = {
|
|||
});
|
||||
return;
|
||||
}
|
||||
const pagesOverview = this.pdfViewer.getPagesOverview();
|
||||
const printContainer = this.appConfig.printContainer;
|
||||
const printResolution = AppOptions.get("printResolution");
|
||||
const optionalContentConfigPromise = this.pdfViewer.optionalContentConfigPromise;
|
||||
const printService = PDFPrintServiceFactory.createPrintService(this.pdfDocument, pagesOverview, printContainer, printResolution, optionalContentConfigPromise, this._printAnnotationStoragePromise);
|
||||
this.printService = printService;
|
||||
this.printService = PDFPrintServiceFactory.createPrintService({
|
||||
pdfDocument: this.pdfDocument,
|
||||
pagesOverview: this.pdfViewer.getPagesOverview(),
|
||||
printContainer: this.appConfig.printContainer,
|
||||
printResolution: AppOptions.get("printResolution"),
|
||||
optionalContentConfigPromise: this.pdfViewer.optionalContentConfigPromise,
|
||||
printAnnotationStoragePromise: this._printAnnotationStoragePromise
|
||||
});
|
||||
this.forceRendering();
|
||||
this.setTitle();
|
||||
printService.layout();
|
||||
this.printService.layout();
|
||||
if (this._hasAnnotationEditors) {
|
||||
this.externalServices.reportTelemetry({
|
||||
type: "editing",
|
||||
|
|
@ -8672,12 +8697,12 @@ const PDFViewerApplication = {
|
|||
initCom(PDFViewerApplication);
|
||||
async function loadFakeWorker() {
|
||||
GlobalWorkerOptions.workerSrc ||= AppOptions.get("workerSrc");
|
||||
await import(/* webpackIgnore: true */ PDFWorker.workerSrc);
|
||||
await import( /*webpackIgnore: true*/PDFWorker.workerSrc);
|
||||
}
|
||||
async function loadPDFBug(self) {
|
||||
const {
|
||||
PDFBug
|
||||
} = await import(/* webpackIgnore: true */ AppOptions.get("debuggerSrc"));
|
||||
} = await import( /*webpackIgnore: true*/AppOptions.get("debuggerSrc"));
|
||||
self._PDFBug = PDFBug;
|
||||
}
|
||||
function reportPageStatsPDFBug({
|
||||
|
|
@ -8750,7 +8775,7 @@ function webViewerNamedAction(evt) {
|
|||
break;
|
||||
case "Find":
|
||||
if (!PDFViewerApplication.supportsIntegratedFind) {
|
||||
PDFViewerApplication?.findBar.toggle();
|
||||
PDFViewerApplication.findBar?.toggle();
|
||||
}
|
||||
break;
|
||||
case "Print":
|
||||
|
|
@ -8915,7 +8940,7 @@ function webViewerUpdateFindMatchesCount({
|
|||
if (PDFViewerApplication.supportsIntegratedFind) {
|
||||
PDFViewerApplication.externalServices.updateFindMatchesCount(matchesCount);
|
||||
} else {
|
||||
PDFViewerApplication.findBar.updateResultsCount(matchesCount);
|
||||
PDFViewerApplication.findBar?.updateResultsCount(matchesCount);
|
||||
}
|
||||
}
|
||||
function webViewerUpdateFindControlState({
|
||||
|
|
@ -9436,8 +9461,8 @@ function webViewerReportTelemetry({
|
|||
|
||||
|
||||
|
||||
const pdfjsVersion = "4.1.181";
|
||||
const pdfjsBuild = "14874e50b";
|
||||
const pdfjsVersion = "4.1.215";
|
||||
const pdfjsBuild = "72b8b2914";
|
||||
const AppConstants = null;
|
||||
window.PDFViewerApplication = PDFViewerApplication;
|
||||
window.PDFViewerApplicationConstants = AppConstants;
|
||||
|
|
|
|||
|
|
@ -174,6 +174,13 @@
|
|||
transform:rotate(90deg) translateY(-100%);
|
||||
}
|
||||
|
||||
&.disabled{
|
||||
section,
|
||||
.popup{
|
||||
pointer-events:none;
|
||||
}
|
||||
}
|
||||
|
||||
canvas{
|
||||
position:absolute;
|
||||
width:100%;
|
||||
|
|
|
|||
|
|
@ -606,6 +606,10 @@ const defaultOptions = {
|
|||
value: false,
|
||||
kind: OptionKind.VIEWER + OptionKind.PREFERENCE
|
||||
},
|
||||
enableML: {
|
||||
value: false,
|
||||
kind: OptionKind.VIEWER + OptionKind.PREFERENCE
|
||||
},
|
||||
enablePermissions: {
|
||||
value: false,
|
||||
kind: OptionKind.VIEWER + OptionKind.PREFERENCE
|
||||
|
|
@ -1444,6 +1448,7 @@ class BasePreferences {
|
|||
defaultZoomValue: "",
|
||||
disablePageLabels: false,
|
||||
enableHighlightEditor: false,
|
||||
enableML: false,
|
||||
enablePermissions: false,
|
||||
enablePrintAutoRotate: true,
|
||||
enableScripting: true,
|
||||
|
|
@ -1807,6 +1812,11 @@ class FirefoxScripting {
|
|||
FirefoxCom.request("destroySandbox", null);
|
||||
}
|
||||
}
|
||||
class MLManager {
|
||||
guess(data) {
|
||||
return FirefoxCom.requestAsync("mlGuess", data);
|
||||
}
|
||||
}
|
||||
class ExternalServices extends BaseExternalServices {
|
||||
updateFindControlState(data) {
|
||||
FirefoxCom.request("updateFindControlState", data);
|
||||
|
|
@ -5401,7 +5411,14 @@ function composePage(pdfDocument, pageNumber, size, printContainer, printResolut
|
|||
};
|
||||
}
|
||||
class FirefoxPrintService {
|
||||
constructor(pdfDocument, pagesOverview, printContainer, printResolution, optionalContentConfigPromise = null, printAnnotationStoragePromise = null) {
|
||||
constructor({
|
||||
pdfDocument,
|
||||
pagesOverview,
|
||||
printContainer,
|
||||
printResolution,
|
||||
optionalContentConfigPromise = null,
|
||||
printAnnotationStoragePromise = null
|
||||
}) {
|
||||
this.pdfDocument = pdfDocument;
|
||||
this.pagesOverview = pagesOverview;
|
||||
this.printContainer = printContainer;
|
||||
|
|
@ -5454,8 +5471,8 @@ class PDFPrintServiceFactory {
|
|||
const canvas = document.createElement("canvas");
|
||||
return shadow(this, "supportsPrinting", "mozPrintCallback" in canvas);
|
||||
}
|
||||
static createPrintService(pdfDocument, pagesOverview, printContainer, printResolution, optionalContentConfigPromise, printAnnotationStoragePromise) {
|
||||
return new FirefoxPrintService(pdfDocument, pagesOverview, printContainer, printResolution, optionalContentConfigPromise, printAnnotationStoragePromise);
|
||||
static createPrintService(params) {
|
||||
return new FirefoxPrintService(params);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -8418,6 +8435,7 @@ class PDFViewer {
|
|||
#containerTopLeft = null;
|
||||
#copyCallbackBound = null;
|
||||
#enablePermissions = false;
|
||||
#mlManager = null;
|
||||
#getAllTextInProgress = false;
|
||||
#hiddenCopyElement = null;
|
||||
#interruptCopyCondition = false;
|
||||
|
|
@ -8428,7 +8446,7 @@ class PDFViewer {
|
|||
#scaleTimeoutId = null;
|
||||
#textLayerMode = TextLayerMode.ENABLE;
|
||||
constructor(options) {
|
||||
const viewerVersion = "4.1.181";
|
||||
const viewerVersion = "4.1.215";
|
||||
if (version !== viewerVersion) {
|
||||
throw new Error(`The API version "${version}" does not match the Viewer version "${viewerVersion}".`);
|
||||
}
|
||||
|
|
@ -8454,6 +8472,7 @@ class PDFViewer {
|
|||
this.l10n = options.l10n;
|
||||
this.#enablePermissions = options.enablePermissions || false;
|
||||
this.pageColors = options.pageColors || null;
|
||||
this.#mlManager = options.mlManager || null;
|
||||
this.defaultRenderingQueue = !options.renderingQueue;
|
||||
this.renderingQueue = options.renderingQueue;
|
||||
this.scroll = watchScroll(this.container, this._scrollUpdate.bind(this));
|
||||
|
|
@ -8813,7 +8832,7 @@ class PDFViewer {
|
|||
if (pdfDocument.isPureXfa) {
|
||||
console.warn("Warning: XFA-editing is not implemented.");
|
||||
} else if (isValidAnnotationEditorMode(mode)) {
|
||||
this.#annotationEditorUIManager = new AnnotationEditorUIManager(this.container, this.viewer, this.#altTextManager, this.eventBus, pdfDocument, this.pageColors, this.#annotationEditorHighlightColors);
|
||||
this.#annotationEditorUIManager = new AnnotationEditorUIManager(this.container, this.viewer, this.#altTextManager, this.eventBus, pdfDocument, this.pageColors, this.#annotationEditorHighlightColors, this.#mlManager);
|
||||
this.eventBus.dispatch("annotationeditoruimanager", {
|
||||
source: this,
|
||||
uiManager: this.#annotationEditorUIManager
|
||||
|
|
@ -10654,7 +10673,8 @@ const PDFViewerApplication = {
|
|||
enablePrintAutoRotate: AppOptions.get("enablePrintAutoRotate"),
|
||||
maxCanvasPixels: AppOptions.get("maxCanvasPixels"),
|
||||
enablePermissions: AppOptions.get("enablePermissions"),
|
||||
pageColors
|
||||
pageColors,
|
||||
mlManager: this.mlManager
|
||||
});
|
||||
this.pdfViewer = pdfViewer;
|
||||
pdfRenderingQueue.setViewer(pdfViewer);
|
||||
|
|
@ -10793,6 +10813,9 @@ const PDFViewerApplication = {
|
|||
get externalServices() {
|
||||
return shadow(this, "externalServices", new ExternalServices());
|
||||
},
|
||||
get mlManager() {
|
||||
return shadow(this, "mlManager", AppOptions.get("enableML") === true ? new MLManager() : null);
|
||||
},
|
||||
get initialized() {
|
||||
return this._initializedCapability.settled;
|
||||
},
|
||||
|
|
@ -11540,15 +11563,17 @@ const PDFViewerApplication = {
|
|||
});
|
||||
return;
|
||||
}
|
||||
const pagesOverview = this.pdfViewer.getPagesOverview();
|
||||
const printContainer = this.appConfig.printContainer;
|
||||
const printResolution = AppOptions.get("printResolution");
|
||||
const optionalContentConfigPromise = this.pdfViewer.optionalContentConfigPromise;
|
||||
const printService = PDFPrintServiceFactory.createPrintService(this.pdfDocument, pagesOverview, printContainer, printResolution, optionalContentConfigPromise, this._printAnnotationStoragePromise);
|
||||
this.printService = printService;
|
||||
this.printService = PDFPrintServiceFactory.createPrintService({
|
||||
pdfDocument: this.pdfDocument,
|
||||
pagesOverview: this.pdfViewer.getPagesOverview(),
|
||||
printContainer: this.appConfig.printContainer,
|
||||
printResolution: AppOptions.get("printResolution"),
|
||||
optionalContentConfigPromise: this.pdfViewer.optionalContentConfigPromise,
|
||||
printAnnotationStoragePromise: this._printAnnotationStoragePromise
|
||||
});
|
||||
this.forceRendering();
|
||||
this.setTitle();
|
||||
printService.layout();
|
||||
this.printService.layout();
|
||||
if (this._hasAnnotationEditors) {
|
||||
this.externalServices.reportTelemetry({
|
||||
type: "editing",
|
||||
|
|
@ -11752,12 +11777,12 @@ const PDFViewerApplication = {
|
|||
initCom(PDFViewerApplication);
|
||||
async function loadFakeWorker() {
|
||||
GlobalWorkerOptions.workerSrc ||= AppOptions.get("workerSrc");
|
||||
await import(/* webpackIgnore: true */ PDFWorker.workerSrc);
|
||||
await import( /*webpackIgnore: true*/PDFWorker.workerSrc);
|
||||
}
|
||||
async function loadPDFBug(self) {
|
||||
const {
|
||||
PDFBug
|
||||
} = await import(/* webpackIgnore: true */ AppOptions.get("debuggerSrc"));
|
||||
} = await import( /*webpackIgnore: true*/AppOptions.get("debuggerSrc"));
|
||||
self._PDFBug = PDFBug;
|
||||
}
|
||||
function reportPageStatsPDFBug({
|
||||
|
|
@ -11830,7 +11855,7 @@ function webViewerNamedAction(evt) {
|
|||
break;
|
||||
case "Find":
|
||||
if (!PDFViewerApplication.supportsIntegratedFind) {
|
||||
PDFViewerApplication?.findBar.toggle();
|
||||
PDFViewerApplication.findBar?.toggle();
|
||||
}
|
||||
break;
|
||||
case "Print":
|
||||
|
|
@ -11995,7 +12020,7 @@ function webViewerUpdateFindMatchesCount({
|
|||
if (PDFViewerApplication.supportsIntegratedFind) {
|
||||
PDFViewerApplication.externalServices.updateFindMatchesCount(matchesCount);
|
||||
} else {
|
||||
PDFViewerApplication.findBar.updateResultsCount(matchesCount);
|
||||
PDFViewerApplication.findBar?.updateResultsCount(matchesCount);
|
||||
}
|
||||
}
|
||||
function webViewerUpdateFindControlState({
|
||||
|
|
@ -12516,8 +12541,8 @@ function webViewerReportTelemetry({
|
|||
|
||||
|
||||
|
||||
const pdfjsVersion = "4.1.181";
|
||||
const pdfjsBuild = "14874e50b";
|
||||
const pdfjsVersion = "4.1.215";
|
||||
const pdfjsBuild = "72b8b2914";
|
||||
const AppConstants = null;
|
||||
window.PDFViewerApplication = PDFViewerApplication;
|
||||
window.PDFViewerApplicationConstants = AppConstants;
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ origin:
|
|||
|
||||
# Human-readable identifier for this version/release
|
||||
# Generally "version NNN", "tag SSS", "bookmark SSS"
|
||||
release: 14874e50b788cb8d2c57cdfa97d37fc0afe6c543 (2024-02-13T13:45:14Z).
|
||||
revision: 14874e50b788cb8d2c57cdfa97d37fc0afe6c543
|
||||
release: 72b8b29147c3a19ccacc9db111df4925efcbe1bf (2024-02-21T09:14:40Z).
|
||||
revision: 72b8b29147c3a19ccacc9db111df4925efcbe1bf
|
||||
|
||||
# The package's license, where possible using the mnemonic from
|
||||
# https://spdx.org/licenses/
|
||||
|
|
|
|||
Loading…
Reference in a new issue