Skip to content
This repository was archived by the owner on Jul 14, 2024. It is now read-only.

Commit 5f07d5a

Browse files
committed
1 parent eb245b8 commit 5f07d5a

115 files changed

Lines changed: 8862 additions & 8404 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

build/pdf.js

Lines changed: 964 additions & 714 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/pdf.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/pdf.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/pdf.sandbox.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/pdf.sandbox.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/pdf.sandbox.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/pdf.worker.js

Lines changed: 83 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class WorkerMessageHandler {
101101
docId,
102102
apiVersion
103103
} = docParams;
104-
const workerVersion = '3.1.81';
104+
const workerVersion = '3.2.146';
105105
if (apiVersion !== workerVersion) {
106106
throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
107107
}
@@ -1251,6 +1251,18 @@ class FeatureTest {
12511251
static get isOffscreenCanvasSupported() {
12521252
return shadow(this, "isOffscreenCanvasSupported", typeof OffscreenCanvas !== "undefined");
12531253
}
1254+
static get platform() {
1255+
if (typeof navigator === "undefined") {
1256+
return shadow(this, "platform", {
1257+
isWin: false,
1258+
isMac: false
1259+
});
1260+
}
1261+
return shadow(this, "platform", {
1262+
isWin: navigator.platform.includes("Win"),
1263+
isMac: navigator.platform.includes("Mac")
1264+
});
1265+
}
12541266
}
12551267
exports.FeatureTest = FeatureTest;
12561268
const hexNumbers = [...Array(256).keys()].map(n => n.toString(16).padStart(2, "0"));
@@ -3108,12 +3120,13 @@ class Page {
31083120
if (this.xfaData) {
31093121
return this.xfaData.bbox;
31103122
}
3111-
const box = this._getInheritableProperty(name, true);
3123+
let box = this._getInheritableProperty(name, true);
31123124
if (Array.isArray(box) && box.length === 4) {
3113-
if (box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
3125+
box = _util.Util.normalizeRect(box);
3126+
if (box[2] - box[0] > 0 && box[3] - box[1] > 0) {
31143127
return box;
31153128
}
3116-
(0, _util.warn)(`Empty /${name} entry.`);
3129+
(0, _util.warn)(`Empty, or invalid, /${name} entry.`);
31173130
}
31183131
return null;
31193132
}
@@ -3135,18 +3148,14 @@ class Page {
31353148
cropBox,
31363149
mediaBox
31373150
} = this;
3138-
let view;
3139-
if (cropBox === mediaBox || (0, _util.isArrayEqual)(cropBox, mediaBox)) {
3140-
view = mediaBox;
3141-
} else {
3151+
if (cropBox !== mediaBox && !(0, _util.isArrayEqual)(cropBox, mediaBox)) {
31423152
const box = _util.Util.intersect(cropBox, mediaBox);
3143-
if (box && box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
3144-
view = box;
3145-
} else {
3146-
(0, _util.warn)("Empty /CropBox and /MediaBox intersection.");
3153+
if (box && box[2] - box[0] > 0 && box[3] - box[1] > 0) {
3154+
return (0, _util.shadow)(this, "view", box);
31473155
}
3156+
(0, _util.warn)("Empty /CropBox and /MediaBox intersection.");
31483157
}
3149-
return (0, _util.shadow)(this, "view", view || mediaBox);
3158+
return (0, _util.shadow)(this, "view", mediaBox);
31503159
}
31513160
get rotate() {
31523161
let rotate = this._getInheritableProperty("Rotate") || 0;
@@ -5514,7 +5523,14 @@ class WidgetAnnotation extends Annotation {
55145523
value = value[0];
55155524
}
55165525
(0, _util.assert)(typeof value === "string", "Expected `value` to be a string.");
5517-
value = value.trim();
5526+
if (!this.data.combo) {
5527+
value = value.trim();
5528+
} else {
5529+
const option = this.data.options.find(({
5530+
exportValue
5531+
}) => value === exportValue) || this.data.options[0];
5532+
value = option && option.displayValue || "";
5533+
}
55185534
if (value === "") {
55195535
return `/Tx BMC q ${colors}Q EMC`;
55205536
}
@@ -7124,9 +7140,15 @@ class StampAnnotation extends MarkupAnnotation {
71247140
class FileAttachmentAnnotation extends MarkupAnnotation {
71257141
constructor(params) {
71267142
super(params);
7127-
const file = new _file_spec.FileSpec(params.dict.get("FS"), params.xref);
7143+
const {
7144+
dict,
7145+
xref
7146+
} = params;
7147+
const file = new _file_spec.FileSpec(dict.get("FS"), xref);
71287148
this.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
71297149
this.data.file = file.serializable;
7150+
const name = dict.get("Name");
7151+
this.data.name = name instanceof _primitives.Name ? (0, _util.stringToPDFString)(name.name) : "PushPin";
71307152
}
71317153
}
71327154

@@ -23456,7 +23478,7 @@ class CFFParser {
2345623478
}
2345723479
let stackSize = state.stackSize;
2345823480
const stack = state.stack;
23459-
const length = data.length;
23481+
let length = data.length;
2346023482
for (let j = 0; j < length;) {
2346123483
const value = data[j++];
2346223484
let validationCommand = null;
@@ -23537,6 +23559,11 @@ class CFFParser {
2353723559
} else if (value === 0 && j === data.length) {
2353823560
data[j - 1] = 14;
2353923561
validationCommand = CharstringValidationData[14];
23562+
} else if (value === 9) {
23563+
data.copyWithin(j - 1, j, -1);
23564+
j -= 1;
23565+
length -= 1;
23566+
continue;
2354023567
} else {
2354123568
validationCommand = CharstringValidationData[value];
2354223569
}
@@ -23589,6 +23616,9 @@ class CFFParser {
2358923616
}
2359023617
}
2359123618
}
23619+
if (length < data.length) {
23620+
data.fill(14, length);
23621+
}
2359223622
state.stackSize = stackSize;
2359323623
return true;
2359423624
}
@@ -63432,19 +63462,18 @@ class XRef {
6343263462
}
6343363463
return skipped;
6343463464
}
63465+
const gEndobjRegExp = /\b(endobj|\d+\s+\d+\s+obj|xref|trailer)\b/g;
63466+
const gStartxrefRegExp = /\b(startxref|\d+\s+\d+\s+obj)\b/g;
6343563467
const objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
63436-
const endobjRegExp = /\bendobj[\b\s]$/;
63437-
const nestedObjRegExp = /\s+(\d+\s+\d+\s+obj[\b\s<])$/;
63438-
const CHECK_CONTENT_LENGTH = 25;
6343963468
const trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]);
6344063469
const startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, 101, 102]);
63441-
const objBytes = new Uint8Array([111, 98, 106]);
6344263470
const xrefBytes = new Uint8Array([47, 88, 82, 101, 102]);
6344363471
this.entries.length = 0;
6344463472
this._cacheMap.clear();
6344563473
const stream = this.stream;
6344663474
stream.pos = 0;
6344763475
const buffer = stream.getBytes(),
63476+
bufferStr = (0, _util.bytesToString)(buffer),
6344863477
length = buffer.length;
6344963478
let position = stream.start;
6345063479
const trailers = [],
@@ -63474,8 +63503,8 @@ class XRef {
6347463503
} else if (m = objRegExp.exec(token)) {
6347563504
const num = m[1] | 0,
6347663505
gen = m[2] | 0;
63506+
const startPos = position + token.length;
6347763507
let contentLength,
63478-
startPos = position + token.length,
6347963508
updateEntries = false;
6348063509
if (!this.entries[num]) {
6348163510
updateEntries = true;
@@ -63501,22 +63530,17 @@ class XRef {
6350163530
uncompressed: true
6350263531
};
6350363532
}
63504-
while (startPos < length) {
63505-
const endPos = startPos + skipUntil(buffer, startPos, objBytes) + 4;
63533+
gEndobjRegExp.lastIndex = startPos;
63534+
const match = gEndobjRegExp.exec(bufferStr);
63535+
if (match) {
63536+
const endPos = gEndobjRegExp.lastIndex + 1;
6350663537
contentLength = endPos - position;
63507-
const checkPos = Math.max(endPos - CHECK_CONTENT_LENGTH, startPos);
63508-
const tokenStr = (0, _util.bytesToString)(buffer.subarray(checkPos, endPos));
63509-
if (endobjRegExp.test(tokenStr)) {
63510-
break;
63511-
} else {
63512-
const objToken = nestedObjRegExp.exec(tokenStr);
63513-
if (objToken && objToken[1]) {
63514-
(0, _util.warn)('indexObjects: Found new "obj" inside of another "obj", ' + 'caused by missing "endobj" -- trying to recover.');
63515-
contentLength -= objToken[1].length;
63516-
break;
63517-
}
63538+
if (match[1] !== "endobj") {
63539+
(0, _util.warn)(`indexObjects: Found "${match[1]}" inside of another "obj", ` + 'caused by missing "endobj" -- trying to recover.');
63540+
contentLength -= match[1].length + 1;
6351863541
}
63519-
startPos = endPos;
63542+
} else {
63543+
contentLength = length - position;
6352063544
}
6352163545
const content = buffer.subarray(position, position + contentLength);
6352263546
const xrefTagOffset = skipUntil(content, 0, xrefBytes);
@@ -63527,17 +63551,19 @@ class XRef {
6352763551
position += contentLength;
6352863552
} else if (token.startsWith("trailer") && (token.length === 7 || /\s/.test(token[7]))) {
6352963553
trailers.push(position);
63530-
const contentLength = skipUntil(buffer, position, startxrefBytes);
63531-
if (position + contentLength >= length) {
63532-
const endPos = position + skipUntil(buffer, position, objBytes) + 4;
63533-
const checkPos = Math.max(endPos - CHECK_CONTENT_LENGTH, position);
63534-
const tokenStr = (0, _util.bytesToString)(buffer.subarray(checkPos, endPos));
63535-
const objToken = nestedObjRegExp.exec(tokenStr);
63536-
if (objToken && objToken[1]) {
63537-
(0, _util.warn)('indexObjects: Found first "obj" after "trailer", ' + 'caused by missing "startxref" -- trying to recover.');
63538-
position = endPos - objToken[1].length;
63539-
continue;
63554+
const startPos = position + token.length;
63555+
let contentLength;
63556+
gStartxrefRegExp.lastIndex = startPos;
63557+
const match = gStartxrefRegExp.exec(bufferStr);
63558+
if (match) {
63559+
const endPos = gStartxrefRegExp.lastIndex + 1;
63560+
contentLength = endPos - position;
63561+
if (match[1] !== "startxref") {
63562+
(0, _util.warn)(`indexObjects: Found "${match[1]}" after "trailer", ` + 'caused by missing "startxref" -- trying to recover.');
63563+
contentLength -= match[1].length + 1;
6354063564
}
63565+
} else {
63566+
contentLength = length - position;
6354163567
}
6354263568
position += contentLength;
6354363569
} else {
@@ -63606,8 +63632,8 @@ class XRef {
6360663632
readXRef(recoveryMode = false) {
6360763633
const stream = this.stream;
6360863634
const startXRefParsedCache = new Set();
63609-
try {
63610-
while (this.startXRefQueue.length) {
63635+
while (this.startXRefQueue.length) {
63636+
try {
6361163637
const startXRef = this.startXRefQueue[0];
6361263638
if (startXRefParsedCache.has(startXRef)) {
6361363639
(0, _util.warn)("readXRef - skipping XRef table since it was already parsed.");
@@ -63656,16 +63682,17 @@ class XRef {
6365663682
} else if (obj instanceof _primitives.Ref) {
6365763683
this.startXRefQueue.push(obj.num);
6365863684
}
63659-
this.startXRefQueue.shift();
63660-
}
63661-
return this.topDict;
63662-
} catch (e) {
63663-
if (e instanceof _core_utils.MissingDataException) {
63664-
throw e;
63685+
} catch (e) {
63686+
if (e instanceof _core_utils.MissingDataException) {
63687+
throw e;
63688+
}
63689+
(0, _util.info)("(while reading XRef): " + e);
6366563690
}
63666-
(0, _util.info)("(while reading XRef): " + e);
6366763691
this.startXRefQueue.shift();
6366863692
}
63693+
if (this.topDict) {
63694+
return this.topDict;
63695+
}
6366963696
if (recoveryMode) {
6367063697
return undefined;
6367163698
}
@@ -64467,8 +64494,8 @@ Object.defineProperty(exports, "WorkerMessageHandler", ({
6446764494
}
6446864495
}));
6446964496
var _worker = __w_pdfjs_require__(1);
64470-
const pdfjsVersion = '3.1.81';
64471-
const pdfjsBuild = '0766898d5';
64497+
const pdfjsVersion = '3.2.146';
64498+
const pdfjsBuild = '3fd2a3548';
6447264499
})();
6447364500

6447464501
/******/ return __webpack_exports__;

build/pdf.worker.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/pdf.worker.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

image_decoders/pdf.image_decoders.js

Lines changed: 14 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)