summaryrefslogtreecommitdiffstats
path: root/toolkit/components/pdfjs/content/build/pdf.worker.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/components/pdfjs/content/build/pdf.worker.mjs')
-rw-r--r--toolkit/components/pdfjs/content/build/pdf.worker.mjs114
1 files changed, 90 insertions, 24 deletions
diff --git a/toolkit/components/pdfjs/content/build/pdf.worker.mjs b/toolkit/components/pdfjs/content/build/pdf.worker.mjs
index 8929572511..e2cd54cf56 100644
--- a/toolkit/components/pdfjs/content/build/pdf.worker.mjs
+++ b/toolkit/components/pdfjs/content/build/pdf.worker.mjs
@@ -94,7 +94,8 @@ const AnnotationEditorParamsType = {
HIGHLIGHT_COLOR: 31,
HIGHLIGHT_DEFAULT_COLOR: 32,
HIGHLIGHT_THICKNESS: 33,
- HIGHLIGHT_FREE: 34
+ HIGHLIGHT_FREE: 34,
+ HIGHLIGHT_SHOW_ALL: 35
};
const PermissionFlag = {
PRINT: 0x04,
@@ -31442,17 +31443,25 @@ class PartialEvaluator {
}
const SMALL_IMAGE_DIMENSIONS = 200;
if (isInline && !dict.has("SMask") && !dict.has("Mask") && w + h < SMALL_IMAGE_DIMENSIONS) {
- const imageObj = new PDFImage({
- xref: this.xref,
- res: resources,
- image,
- isInline,
- pdfFunctionFactory: this._pdfFunctionFactory,
- localColorSpaceCache
- });
- imgData = await imageObj.createImageData(true, false);
- operatorList.isOffscreenCanvasSupported = this.options.isOffscreenCanvasSupported;
- operatorList.addImageOps(OPS.paintInlineImageXObject, [imgData], optionalContent);
+ try {
+ const imageObj = new PDFImage({
+ xref: this.xref,
+ res: resources,
+ image,
+ isInline,
+ pdfFunctionFactory: this._pdfFunctionFactory,
+ localColorSpaceCache
+ });
+ imgData = await imageObj.createImageData(true, false);
+ operatorList.isOffscreenCanvasSupported = this.options.isOffscreenCanvasSupported;
+ operatorList.addImageOps(OPS.paintInlineImageXObject, [imgData], optionalContent);
+ } catch (reason) {
+ const msg = `Unable to decode inline image: "${reason}".`;
+ if (!this.options.ignoreErrors) {
+ throw new Error(msg);
+ }
+ warn(msg);
+ }
return;
}
let objId = `img_${this.idFactory.createObjId()}`,
@@ -38663,14 +38672,9 @@ class Catalog {
continue;
}
groupRefs.put(groupRef);
- const group = this.xref.fetch(groupRef);
- groups.push({
- id: groupRef.toString(),
- name: typeof group.get("Name") === "string" ? stringToPDFString(group.get("Name")) : null,
- intent: typeof group.get("Intent") === "string" ? stringToPDFString(group.get("Intent")) : null
- });
+ groups.push(this.#readOptionalContentGroup(groupRef));
}
- config = this._readOptionalContentConfig(defaultConfig, groupRefs);
+ config = this.#readOptionalContentConfig(defaultConfig, groupRefs);
config.groups = groups;
} catch (ex) {
if (ex instanceof MissingDataException) {
@@ -38680,7 +38684,62 @@ class Catalog {
}
return shadow(this, "optionalContentConfig", config);
}
- _readOptionalContentConfig(config, contentGroupRefs) {
+ #readOptionalContentGroup(groupRef) {
+ const group = this.xref.fetch(groupRef);
+ const obj = {
+ id: groupRef.toString(),
+ name: null,
+ intent: null,
+ usage: {
+ print: null,
+ view: null
+ }
+ };
+ const name = group.get("Name");
+ if (typeof name === "string") {
+ obj.name = stringToPDFString(name);
+ }
+ let intent = group.getArray("Intent");
+ if (!Array.isArray(intent)) {
+ intent = [intent];
+ }
+ if (intent.every(i => i instanceof Name)) {
+ obj.intent = intent.map(i => i.name);
+ }
+ const usage = group.get("Usage");
+ if (!(usage instanceof Dict)) {
+ return obj;
+ }
+ const usageObj = obj.usage;
+ const print = usage.get("Print");
+ if (print instanceof Dict) {
+ const printState = print.get("PrintState");
+ if (printState instanceof Name) {
+ switch (printState.name) {
+ case "ON":
+ case "OFF":
+ usageObj.print = {
+ printState: printState.name
+ };
+ }
+ }
+ }
+ const view = usage.get("View");
+ if (view instanceof Dict) {
+ const viewState = view.get("ViewState");
+ if (viewState instanceof Name) {
+ switch (viewState.name) {
+ case "ON":
+ case "OFF":
+ usageObj.view = {
+ viewState: viewState.name
+ };
+ }
+ }
+ }
+ return obj;
+ }
+ #readOptionalContentConfig(config, contentGroupRefs) {
function parseOnOff(refs) {
const onParsed = [];
if (Array.isArray(refs)) {
@@ -55084,17 +55143,24 @@ class Page {
}));
}
const sortedAnnotations = [];
- let popupAnnotations;
+ let popupAnnotations, widgetAnnotations;
for (const annotation of await Promise.all(annotationPromises)) {
if (!annotation) {
continue;
}
+ if (annotation instanceof WidgetAnnotation) {
+ (widgetAnnotations ||= []).push(annotation);
+ continue;
+ }
if (annotation instanceof PopupAnnotation) {
(popupAnnotations ||= []).push(annotation);
continue;
}
sortedAnnotations.push(annotation);
}
+ if (widgetAnnotations) {
+ sortedAnnotations.push(...widgetAnnotations);
+ }
if (popupAnnotations) {
sortedAnnotations.push(...popupAnnotations);
}
@@ -56659,7 +56725,7 @@ class WorkerMessageHandler {
docId,
apiVersion
} = docParams;
- const workerVersion = "4.1.249";
+ const workerVersion = "4.1.342";
if (apiVersion !== workerVersion) {
throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
}
@@ -57221,8 +57287,8 @@ if (typeof window === "undefined" && !isNodeJS && typeof self !== "undefined" &&
;// CONCATENATED MODULE: ./src/pdf.worker.js
-const pdfjsVersion = "4.1.249";
-const pdfjsBuild = "d07f37f44";
+const pdfjsVersion = "4.1.342";
+const pdfjsBuild = "e384df6f1";
var __webpack_exports__WorkerMessageHandler = __webpack_exports__.WorkerMessageHandler;
export { __webpack_exports__WorkerMessageHandler as WorkerMessageHandler };