зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1727189 - Update pdf.js to version 2.11.142 r=Snuffleupagus
Differential Revision: https://phabricator.services.mozilla.com/D123388
This commit is contained in:
Родитель
ba3d35886e
Коммит
65f2acf457
|
@ -1,5 +1,5 @@
|
|||
This is the PDF.js project output, https://github.com/mozilla/pdf.js
|
||||
|
||||
Current extension version is: 2.11.91
|
||||
Current extension version is: 2.11.142
|
||||
|
||||
Taken from upstream commit: 3d18c76a5
|
||||
Taken from upstream commit: 56e7bb626
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -4902,8 +4902,8 @@ Object.defineProperty(exports, "initSandbox", ({
|
|||
|
||||
var _initialization = __w_pdfjs_require__(1);
|
||||
|
||||
const pdfjsVersion = '2.11.91';
|
||||
const pdfjsBuild = '3d18c76a5';
|
||||
const pdfjsVersion = '2.11.142';
|
||||
const pdfjsBuild = '56e7bb626';
|
||||
})();
|
||||
|
||||
/******/ return __webpack_exports__;
|
||||
|
|
|
@ -125,7 +125,7 @@ class WorkerMessageHandler {
|
|||
const WorkerTasks = [];
|
||||
const verbosity = (0, _util.getVerbosityLevel)();
|
||||
const apiVersion = docParams.apiVersion;
|
||||
const workerVersion = '2.11.91';
|
||||
const workerVersion = '2.11.142';
|
||||
|
||||
if (apiVersion !== workerVersion) {
|
||||
throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
|
||||
|
@ -577,7 +577,7 @@ class WorkerMessageHandler {
|
|||
sink,
|
||||
task,
|
||||
intent: data.intent,
|
||||
renderInteractiveForms: data.renderInteractiveForms,
|
||||
cacheKey: data.cacheKey,
|
||||
annotationStorage: data.annotationStorage
|
||||
}).then(function (operatorListInfo) {
|
||||
finishWorkerTask(task);
|
||||
|
@ -741,7 +741,7 @@ exports.stringToUTF8String = stringToUTF8String;
|
|||
exports.unreachable = unreachable;
|
||||
exports.utf8StringToString = utf8StringToString;
|
||||
exports.warn = warn;
|
||||
exports.VerbosityLevel = exports.Util = exports.UNSUPPORTED_FEATURES = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.PageActionEventType = exports.OPS = exports.MissingPDFException = exports.IsLittleEndianCached = exports.IsEvalSupportedCached = exports.InvalidPDFException = exports.ImageKind = exports.IDENTITY_MATRIX = exports.FormatError = exports.FontType = exports.FONT_IDENTITY_MATRIX = exports.DocumentActionEventType = exports.CMapCompressionType = exports.BaseException = exports.AnnotationType = exports.AnnotationStateModelType = exports.AnnotationReviewState = exports.AnnotationReplyType = exports.AnnotationMarkedState = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.AnnotationActionEventType = exports.AbortException = void 0;
|
||||
exports.VerbosityLevel = exports.Util = exports.UNSUPPORTED_FEATURES = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.RenderingIntentFlag = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.PageActionEventType = exports.OPS = exports.MissingPDFException = exports.IsLittleEndianCached = exports.IsEvalSupportedCached = exports.InvalidPDFException = exports.ImageKind = exports.IDENTITY_MATRIX = exports.FormatError = exports.FontType = exports.FONT_IDENTITY_MATRIX = exports.DocumentActionEventType = exports.CMapCompressionType = exports.BaseException = exports.AnnotationType = exports.AnnotationStateModelType = exports.AnnotationReviewState = exports.AnnotationReplyType = exports.AnnotationMarkedState = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.AnnotationActionEventType = exports.AbortException = void 0;
|
||||
|
||||
__w_pdfjs_require__(3);
|
||||
|
||||
|
@ -749,6 +749,15 @@ const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
|
|||
exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
|
||||
const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
|
||||
exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
|
||||
const RenderingIntentFlag = {
|
||||
ANY: 0x01,
|
||||
DISPLAY: 0x02,
|
||||
PRINT: 0x04,
|
||||
ANNOTATIONS_FORMS: 0x10,
|
||||
ANNOTATIONS_STORAGE: 0x20,
|
||||
OPLIST: 0x100
|
||||
};
|
||||
exports.RenderingIntentFlag = RenderingIntentFlag;
|
||||
const PermissionFlag = {
|
||||
PRINT: 0x04,
|
||||
MODIFY_CONTENTS: 0x08,
|
||||
|
@ -1164,13 +1173,13 @@ function shadow(obj, prop, value) {
|
|||
}
|
||||
|
||||
const BaseException = function BaseExceptionClosure() {
|
||||
function BaseException(message) {
|
||||
function BaseException(message, name) {
|
||||
if (this.constructor === BaseException) {
|
||||
unreachable("Cannot initialize BaseException.");
|
||||
}
|
||||
|
||||
this.message = message;
|
||||
this.name = this.constructor.name;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
BaseException.prototype = new Error();
|
||||
|
@ -1182,7 +1191,7 @@ exports.BaseException = BaseException;
|
|||
|
||||
class PasswordException extends BaseException {
|
||||
constructor(msg, code) {
|
||||
super(msg);
|
||||
super(msg, "PasswordException");
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
|
@ -1192,7 +1201,7 @@ exports.PasswordException = PasswordException;
|
|||
|
||||
class UnknownErrorException extends BaseException {
|
||||
constructor(msg, details) {
|
||||
super(msg);
|
||||
super(msg, "UnknownErrorException");
|
||||
this.details = details;
|
||||
}
|
||||
|
||||
|
@ -1200,17 +1209,27 @@ class UnknownErrorException extends BaseException {
|
|||
|
||||
exports.UnknownErrorException = UnknownErrorException;
|
||||
|
||||
class InvalidPDFException extends BaseException {}
|
||||
class InvalidPDFException extends BaseException {
|
||||
constructor(msg) {
|
||||
super(msg, "InvalidPDFException");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.InvalidPDFException = InvalidPDFException;
|
||||
|
||||
class MissingPDFException extends BaseException {}
|
||||
class MissingPDFException extends BaseException {
|
||||
constructor(msg) {
|
||||
super(msg, "MissingPDFException");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.MissingPDFException = MissingPDFException;
|
||||
|
||||
class UnexpectedResponseException extends BaseException {
|
||||
constructor(msg, status) {
|
||||
super(msg);
|
||||
super(msg, "UnexpectedResponseException");
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
@ -1218,11 +1237,21 @@ class UnexpectedResponseException extends BaseException {
|
|||
|
||||
exports.UnexpectedResponseException = UnexpectedResponseException;
|
||||
|
||||
class FormatError extends BaseException {}
|
||||
class FormatError extends BaseException {
|
||||
constructor(msg) {
|
||||
super(msg, "FormatError");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.FormatError = FormatError;
|
||||
|
||||
class AbortException extends BaseException {}
|
||||
class AbortException extends BaseException {
|
||||
constructor(msg) {
|
||||
super(msg, "AbortException");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.AbortException = AbortException;
|
||||
const NullCharactersRegExp = /\x00/g;
|
||||
|
@ -1839,7 +1868,7 @@ class Dict {
|
|||
if (property === undefined) {
|
||||
property = [];
|
||||
properties.set(key, property);
|
||||
} else if (!mergeSubDicts) {
|
||||
} else if (!mergeSubDicts || !(value instanceof Dict)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1856,10 +1885,6 @@ class Dict {
|
|||
const subDict = new Dict(xref);
|
||||
|
||||
for (const dict of values) {
|
||||
if (!(dict instanceof Dict)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (const [key, value] of Object.entries(dict._map)) {
|
||||
if (subDict._map[key] === undefined) {
|
||||
subDict._map[key] = value;
|
||||
|
@ -2977,7 +3002,7 @@ function getArrayLookupTableFactory(initializer) {
|
|||
|
||||
class MissingDataException extends _util.BaseException {
|
||||
constructor(begin, end) {
|
||||
super(`Missing data [${begin}, ${end})`);
|
||||
super(`Missing data [${begin}, ${end})`, "MissingDataException");
|
||||
this.begin = begin;
|
||||
this.end = end;
|
||||
}
|
||||
|
@ -2986,15 +3011,30 @@ class MissingDataException extends _util.BaseException {
|
|||
|
||||
exports.MissingDataException = MissingDataException;
|
||||
|
||||
class ParserEOFException extends _util.BaseException {}
|
||||
class ParserEOFException extends _util.BaseException {
|
||||
constructor(msg) {
|
||||
super(msg, "ParserEOFException");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.ParserEOFException = ParserEOFException;
|
||||
|
||||
class XRefEntryException extends _util.BaseException {}
|
||||
class XRefEntryException extends _util.BaseException {
|
||||
constructor(msg) {
|
||||
super(msg, "XRefEntryException");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.XRefEntryException = XRefEntryException;
|
||||
|
||||
class XRefParseException extends _util.BaseException {}
|
||||
class XRefParseException extends _util.BaseException {
|
||||
constructor(msg) {
|
||||
super(msg, "XRefParseException");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.XRefParseException = XRefParseException;
|
||||
|
||||
|
@ -3695,8 +3735,8 @@ class Page {
|
|||
sink,
|
||||
task,
|
||||
intent,
|
||||
renderInteractiveForms,
|
||||
annotationStorage
|
||||
cacheKey,
|
||||
annotationStorage = null
|
||||
}) {
|
||||
const contentStreamPromise = this.getContentStream(handler);
|
||||
const resourcesPromise = this.loadResources(["ColorSpace", "ExtGState", "Font", "Pattern", "Properties", "Shading", "XObject"]);
|
||||
|
@ -3717,7 +3757,7 @@ class Page {
|
|||
handler.send("StartRenderPage", {
|
||||
transparency: partialEvaluator.hasBlendModes(this.resources, this.nonBlendModesSet),
|
||||
pageIndex: this.pageIndex,
|
||||
intent
|
||||
cacheKey
|
||||
});
|
||||
return partialEvaluator.getOperatorList({
|
||||
stream: contentStream,
|
||||
|
@ -3736,12 +3776,15 @@ class Page {
|
|||
};
|
||||
}
|
||||
|
||||
const annotationIntent = intent.startsWith("oplist-") ? intent.split("-")[1] : intent;
|
||||
const renderForms = !!(intent & _util.RenderingIntentFlag.ANNOTATIONS_FORMS),
|
||||
intentAny = !!(intent & _util.RenderingIntentFlag.ANY),
|
||||
intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY),
|
||||
intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT);
|
||||
const opListPromises = [];
|
||||
|
||||
for (const annotation of annotations) {
|
||||
if (annotationIntent === "display" && annotation.mustBeViewed(annotationStorage) || annotationIntent === "print" && annotation.mustBePrinted(annotationStorage)) {
|
||||
opListPromises.push(annotation.getOperatorList(partialEvaluator, task, renderInteractiveForms, annotationStorage).catch(function (reason) {
|
||||
if (intentAny || intentDisplay && annotation.mustBeViewed(annotationStorage) || intentPrint && annotation.mustBePrinted(annotationStorage)) {
|
||||
opListPromises.push(annotation.getOperatorList(partialEvaluator, task, renderForms, annotationStorage).catch(function (reason) {
|
||||
(0, _util.warn)("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
|
||||
return null;
|
||||
}));
|
||||
|
@ -3820,9 +3863,17 @@ class Page {
|
|||
return this._parsedAnnotations.then(function (annotations) {
|
||||
const annotationsData = [];
|
||||
|
||||
for (let i = 0, ii = annotations.length; i < ii; i++) {
|
||||
if (!intent || intent === "display" && annotations[i].viewable || intent === "print" && annotations[i].printable) {
|
||||
annotationsData.push(annotations[i].data);
|
||||
if (annotations.length === 0) {
|
||||
return annotationsData;
|
||||
}
|
||||
|
||||
const intentAny = !!(intent & _util.RenderingIntentFlag.ANY),
|
||||
intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY),
|
||||
intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT);
|
||||
|
||||
for (const annotation of annotations) {
|
||||
if (intentAny || intentDisplay && annotation.viewable || intentPrint && annotation.printable) {
|
||||
annotationsData.push(annotation.data);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4176,7 +4227,7 @@ class PDFDocument {
|
|||
}
|
||||
|
||||
get xfaFactory() {
|
||||
if (this.pdfManager.enableXfa && this.formInfo.hasXfa && !this.formInfo.hasAcroForm) {
|
||||
if (this.pdfManager.enableXfa && this.catalog.needsRendering && this.formInfo.hasXfa && !this.formInfo.hasAcroForm) {
|
||||
const data = this.xfaData;
|
||||
return (0, _util.shadow)(this, "xfaFactory", data ? new _factory.XFAFactory(data) : null);
|
||||
}
|
||||
|
@ -10103,7 +10154,7 @@ class PartialEvaluator {
|
|||
return transferMaps;
|
||||
}
|
||||
|
||||
handleTilingType(fn, color, resources, pattern, patternDict, operatorList, task, cacheKey, localTilingPatternCache) {
|
||||
handleTilingType(fn, color, resources, pattern, patternDict, operatorList, task, localTilingPatternCache) {
|
||||
const tilingOpList = new _operator_list.OperatorList();
|
||||
|
||||
const patternResources = _primitives.Dict.merge({
|
||||
|
@ -10122,8 +10173,8 @@ class PartialEvaluator {
|
|||
operatorList.addDependencies(tilingOpList.dependencies);
|
||||
operatorList.addOp(fn, tilingPatternIR);
|
||||
|
||||
if (cacheKey) {
|
||||
localTilingPatternCache.set(cacheKey, patternDict.objId, {
|
||||
if (patternDict.objId) {
|
||||
localTilingPatternCache.set(null, patternDict.objId, {
|
||||
operatorListIR,
|
||||
dict: patternDict
|
||||
});
|
||||
|
@ -10548,8 +10599,8 @@ class PartialEvaluator {
|
|||
const patternName = args.pop();
|
||||
|
||||
if (patternName instanceof _primitives.Name) {
|
||||
const name = patternName.name;
|
||||
const localTilingPattern = localTilingPatternCache.getByName(name);
|
||||
const rawPattern = patterns.getRaw(patternName.name);
|
||||
const localTilingPattern = rawPattern instanceof _primitives.Ref && localTilingPatternCache.getByRef(rawPattern);
|
||||
|
||||
if (localTilingPattern) {
|
||||
try {
|
||||
|
@ -10560,7 +10611,7 @@ class PartialEvaluator {
|
|||
} catch (ex) {}
|
||||
}
|
||||
|
||||
const pattern = patterns.get(name);
|
||||
const pattern = this.xref.fetchIfRef(rawPattern);
|
||||
|
||||
if (pattern) {
|
||||
const dict = (0, _primitives.isStream)(pattern) ? pattern.dict : pattern;
|
||||
|
@ -10568,7 +10619,7 @@ class PartialEvaluator {
|
|||
|
||||
if (typeNum === PatternType.TILING) {
|
||||
const color = cs.base ? cs.base.getRgb(args, 0) : null;
|
||||
return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task, name, localTilingPatternCache);
|
||||
return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task, localTilingPatternCache);
|
||||
} else if (typeNum === PatternType.SHADING) {
|
||||
const shading = dict.get("Shading");
|
||||
const matrix = dict.getArray("Matrix");
|
||||
|
@ -17582,7 +17633,7 @@ var _ccitt = __w_pdfjs_require__(32);
|
|||
|
||||
class Jbig2Error extends _util.BaseException {
|
||||
constructor(msg) {
|
||||
super(`JBIG2 error: ${msg}`);
|
||||
super(`JBIG2 error: ${msg}`, "Jbig2Error");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -20230,20 +20281,25 @@ var _core_utils = __w_pdfjs_require__(9);
|
|||
|
||||
class JpegError extends _util.BaseException {
|
||||
constructor(msg) {
|
||||
super(`JPEG error: ${msg}`);
|
||||
super(`JPEG error: ${msg}`, "JpegError");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class DNLMarkerError extends _util.BaseException {
|
||||
constructor(message, scanLines) {
|
||||
super(message);
|
||||
super(message, "DNLMarkerError");
|
||||
this.scanLines = scanLines;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class EOIMarkerError extends _util.BaseException {}
|
||||
class EOIMarkerError extends _util.BaseException {
|
||||
constructor(msg) {
|
||||
super(msg, "EOIMarkerError");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const dctZigZag = new Uint8Array([0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51, 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63]);
|
||||
const dctCos1 = 4017;
|
||||
|
@ -21554,7 +21610,7 @@ var _arithmetic_decoder = __w_pdfjs_require__(36);
|
|||
|
||||
class JpxError extends _util.BaseException {
|
||||
constructor(msg) {
|
||||
super(`JPX error: ${msg}`);
|
||||
super(`JPX error: ${msg}`, "JpxError");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -29376,12 +29432,17 @@ const getGlyphMapForStandardFonts = (0, _core_utils.getLookupTableFactory)(funct
|
|||
t[169] = 171;
|
||||
t[170] = 187;
|
||||
t[171] = 8230;
|
||||
t[200] = 193;
|
||||
t[203] = 205;
|
||||
t[210] = 218;
|
||||
t[223] = 711;
|
||||
t[224] = 321;
|
||||
t[225] = 322;
|
||||
t[226] = 352;
|
||||
t[227] = 353;
|
||||
t[228] = 381;
|
||||
t[229] = 382;
|
||||
t[233] = 221;
|
||||
t[234] = 253;
|
||||
t[252] = 263;
|
||||
t[253] = 268;
|
||||
|
@ -29391,11 +29452,13 @@ const getGlyphMapForStandardFonts = (0, _core_utils.getLookupTableFactory)(funct
|
|||
t[261] = 261;
|
||||
t[265] = 280;
|
||||
t[266] = 281;
|
||||
t[267] = 282;
|
||||
t[268] = 283;
|
||||
t[269] = 313;
|
||||
t[275] = 323;
|
||||
t[276] = 324;
|
||||
t[278] = 328;
|
||||
t[283] = 344;
|
||||
t[284] = 345;
|
||||
t[285] = 346;
|
||||
t[286] = 347;
|
||||
|
@ -29611,14 +29674,19 @@ exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBl
|
|||
const getSupplementalGlyphMapForCalibri = (0, _core_utils.getLookupTableFactory)(function (t) {
|
||||
t[1] = 32;
|
||||
t[4] = 65;
|
||||
t[6] = 193;
|
||||
t[17] = 66;
|
||||
t[18] = 67;
|
||||
t[21] = 268;
|
||||
t[24] = 68;
|
||||
t[28] = 69;
|
||||
t[30] = 201;
|
||||
t[32] = 282;
|
||||
t[38] = 70;
|
||||
t[39] = 71;
|
||||
t[44] = 72;
|
||||
t[47] = 73;
|
||||
t[49] = 205;
|
||||
t[58] = 74;
|
||||
t[60] = 75;
|
||||
t[62] = 76;
|
||||
|
@ -29628,26 +29696,35 @@ const getSupplementalGlyphMapForCalibri = (0, _core_utils.getLookupTableFactory)
|
|||
t[87] = 80;
|
||||
t[89] = 81;
|
||||
t[90] = 82;
|
||||
t[92] = 344;
|
||||
t[94] = 83;
|
||||
t[97] = 352;
|
||||
t[100] = 84;
|
||||
t[104] = 85;
|
||||
t[115] = 86;
|
||||
t[116] = 87;
|
||||
t[121] = 88;
|
||||
t[122] = 89;
|
||||
t[124] = 221;
|
||||
t[127] = 90;
|
||||
t[129] = 381;
|
||||
t[258] = 97;
|
||||
t[260] = 225;
|
||||
t[268] = 261;
|
||||
t[271] = 98;
|
||||
t[272] = 99;
|
||||
t[273] = 263;
|
||||
t[275] = 269;
|
||||
t[282] = 100;
|
||||
t[286] = 101;
|
||||
t[288] = 233;
|
||||
t[290] = 283;
|
||||
t[295] = 281;
|
||||
t[296] = 102;
|
||||
t[336] = 103;
|
||||
t[346] = 104;
|
||||
t[349] = 105;
|
||||
t[351] = 237;
|
||||
t[361] = 106;
|
||||
t[364] = 107;
|
||||
t[367] = 108;
|
||||
|
@ -29659,15 +29736,19 @@ const getSupplementalGlyphMapForCalibri = (0, _core_utils.getLookupTableFactory)
|
|||
t[393] = 112;
|
||||
t[395] = 113;
|
||||
t[396] = 114;
|
||||
t[398] = 345;
|
||||
t[400] = 115;
|
||||
t[401] = 347;
|
||||
t[403] = 353;
|
||||
t[410] = 116;
|
||||
t[437] = 117;
|
||||
t[448] = 118;
|
||||
t[449] = 119;
|
||||
t[454] = 120;
|
||||
t[455] = 121;
|
||||
t[457] = 253;
|
||||
t[460] = 122;
|
||||
t[462] = 382;
|
||||
t[463] = 380;
|
||||
t[853] = 44;
|
||||
t[855] = 58;
|
||||
|
@ -35333,7 +35414,9 @@ class BaseLocalCache {
|
|||
(0, _util.unreachable)("Cannot initialize BaseLocalCache.");
|
||||
}
|
||||
|
||||
if (!options || !options.onlyRefs) {
|
||||
this._onlyRefs = (options && options.onlyRefs) === true;
|
||||
|
||||
if (!this._onlyRefs) {
|
||||
this._nameRefMap = new Map();
|
||||
this._imageMap = new Map();
|
||||
}
|
||||
|
@ -35342,6 +35425,10 @@ class BaseLocalCache {
|
|||
}
|
||||
|
||||
getByName(name) {
|
||||
if (this._onlyRefs) {
|
||||
(0, _util.unreachable)("Should not call `getByName` method.");
|
||||
}
|
||||
|
||||
const ref = this._nameRefMap.get(name);
|
||||
|
||||
if (ref) {
|
||||
|
@ -35428,10 +35515,6 @@ class LocalFunctionCache extends BaseLocalCache {
|
|||
});
|
||||
}
|
||||
|
||||
getByName(name) {
|
||||
(0, _util.unreachable)("Should not call `getByName` method.");
|
||||
}
|
||||
|
||||
set(name = null, ref, data) {
|
||||
if (!ref) {
|
||||
throw new Error('LocalFunctionCache.set - expected "ref" argument.');
|
||||
|
@ -35478,28 +35561,22 @@ class LocalGStateCache extends BaseLocalCache {
|
|||
exports.LocalGStateCache = LocalGStateCache;
|
||||
|
||||
class LocalTilingPatternCache extends BaseLocalCache {
|
||||
set(name, ref = null, data) {
|
||||
if (typeof name !== "string") {
|
||||
throw new Error('LocalTilingPatternCache.set - expected "name" argument.');
|
||||
constructor(options) {
|
||||
super({
|
||||
onlyRefs: true
|
||||
});
|
||||
}
|
||||
|
||||
set(name = null, ref, data) {
|
||||
if (!ref) {
|
||||
throw new Error('LocalTilingPatternCache.set - expected "ref" argument.');
|
||||
}
|
||||
|
||||
if (ref) {
|
||||
if (this._imageCache.has(ref)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._nameRefMap.set(name, ref);
|
||||
|
||||
this._imageCache.put(ref, data);
|
||||
|
||||
if (this._imageCache.has(ref)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._imageMap.has(name)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._imageMap.set(name, data);
|
||||
this._imageCache.put(ref, data);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -39552,12 +39629,12 @@ class OperatorList {
|
|||
return (0, _util.shadow)(this, "CHUNK_SIZE_ABOUT", this.CHUNK_SIZE - 5);
|
||||
}
|
||||
|
||||
constructor(intent, streamSink) {
|
||||
constructor(intent = 0, streamSink) {
|
||||
this._streamSink = streamSink;
|
||||
this.fnArray = [];
|
||||
this.argsArray = [];
|
||||
|
||||
if (streamSink && !(intent && intent.startsWith("oplist-"))) {
|
||||
if (streamSink && !(intent & _util.RenderingIntentFlag.OPLIST)) {
|
||||
this.optimizer = new QueueOptimizer(this);
|
||||
} else {
|
||||
this.optimizer = new NullOptimizer(this);
|
||||
|
@ -40421,6 +40498,16 @@ class Catalog {
|
|||
return (0, _util.shadow)(this, "version", version.name);
|
||||
}
|
||||
|
||||
get needsRendering() {
|
||||
const needsRendering = this._catDict.get("NeedsRendering");
|
||||
|
||||
if (!(0, _util.isBool)(needsRendering)) {
|
||||
return (0, _util.shadow)(this, "needsRendering", false);
|
||||
}
|
||||
|
||||
return (0, _util.shadow)(this, "needsRendering", needsRendering);
|
||||
}
|
||||
|
||||
get collection() {
|
||||
let collection = null;
|
||||
|
||||
|
@ -59793,7 +59880,8 @@ const StreamKind = {
|
|||
};
|
||||
|
||||
function wrapReason(reason) {
|
||||
if (typeof reason !== "object" || reason === null) {
|
||||
if (!(reason instanceof Error || typeof reason === "object" && reason !== null)) {
|
||||
(0, _util.warn)('wrapReason: Expected "reason" to be a (possibly cloned) Error.');
|
||||
return reason;
|
||||
}
|
||||
|
||||
|
@ -60458,8 +60546,8 @@ Object.defineProperty(exports, "WorkerMessageHandler", ({
|
|||
|
||||
var _worker = __w_pdfjs_require__(1);
|
||||
|
||||
const pdfjsVersion = '2.11.91';
|
||||
const pdfjsBuild = '3d18c76a5';
|
||||
const pdfjsVersion = '2.11.142';
|
||||
const pdfjsBuild = '56e7bb626';
|
||||
})();
|
||||
|
||||
/******/ return __webpack_exports__;
|
||||
|
|
|
@ -540,7 +540,8 @@ window.PDFBug = (function PDFBugClosure() {
|
|||
});
|
||||
}
|
||||
},
|
||||
init(pdfjsLib, container) {
|
||||
init(pdfjsLib, container, ids) {
|
||||
this.enable(ids);
|
||||
/*
|
||||
* Basic Layout:
|
||||
* PDFBug
|
||||
|
@ -589,12 +590,8 @@ window.PDFBug = (function PDFBugClosure() {
|
|||
tool.init(pdfjsLib);
|
||||
} else {
|
||||
panel.textContent =
|
||||
tool.name +
|
||||
" is disabled. To enable add " +
|
||||
' "' +
|
||||
tool.id +
|
||||
'" to the pdfBug parameter ' +
|
||||
"and refresh (separate multiple by commas).";
|
||||
`${tool.name} is disabled. To enable add "${tool.id}" to ` +
|
||||
"the pdfBug parameter and refresh (separate multiple by commas).";
|
||||
}
|
||||
buttons.push(panelButton);
|
||||
}
|
||||
|
|
|
@ -293,6 +293,37 @@
|
|||
--unfocused-field-background: url("data:image/svg+xml;charset=UTF-8,<svg width='1px' height='1px' xmlns='http://www.w3.org/2000/svg'><rect width='100%' height='100%' style='fill:rgba(0, 54, 255, 0.13);'/></svg>");
|
||||
}
|
||||
|
||||
.xfaLayer .highlight {
|
||||
margin: -1px;
|
||||
padding: 1px;
|
||||
background-color: rgba(239, 203, 237, 1);
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.xfaLayer .highlight.appended {
|
||||
position: initial;
|
||||
}
|
||||
|
||||
.xfaLayer .highlight.begin {
|
||||
border-radius: 4px 0 0 4px;
|
||||
}
|
||||
|
||||
.xfaLayer .highlight.end {
|
||||
border-radius: 0 4px 4px 0;
|
||||
}
|
||||
|
||||
.xfaLayer .highlight.middle {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.xfaLayer .highlight.selected {
|
||||
background-color: rgba(203, 223, 203, 1);
|
||||
}
|
||||
|
||||
.xfaLayer ::selection {
|
||||
background: rgba(0, 0, 255, 1);
|
||||
}
|
||||
|
||||
.xfaPage {
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
|
|
|
@ -336,11 +336,11 @@ var _pdf_thumbnail_viewer = __webpack_require__(24);
|
|||
|
||||
var _pdf_viewer = __webpack_require__(26);
|
||||
|
||||
var _secondary_toolbar = __webpack_require__(34);
|
||||
var _secondary_toolbar = __webpack_require__(35);
|
||||
|
||||
var _toolbar = __webpack_require__(36);
|
||||
var _toolbar = __webpack_require__(37);
|
||||
|
||||
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;
|
||||
|
@ -495,13 +495,13 @@ const PDFViewerApplication = {
|
|||
|
||||
async _parseHashParameters() {
|
||||
if (!_app_options.AppOptions.get("pdfBugEnabled")) {
|
||||
return undefined;
|
||||
return;
|
||||
}
|
||||
|
||||
const hash = document.location.hash.substring(1);
|
||||
|
||||
if (!hash) {
|
||||
return undefined;
|
||||
return;
|
||||
}
|
||||
|
||||
const params = (0, _ui_utils.parseQueryString)(hash),
|
||||
|
@ -557,16 +557,18 @@ const PDFViewerApplication = {
|
|||
_app_options.AppOptions.set("fontExtraProperties", true);
|
||||
|
||||
const enabled = params.get("pdfbug").split(",");
|
||||
waitOn.push(loadAndEnablePDFBug(enabled));
|
||||
waitOn.push(initPDFBug(enabled));
|
||||
}
|
||||
|
||||
if (waitOn.length === 0) {
|
||||
return undefined;
|
||||
return;
|
||||
}
|
||||
|
||||
return Promise.all(waitOn).catch(reason => {
|
||||
try {
|
||||
await Promise.all(waitOn);
|
||||
} catch (reason) {
|
||||
console.error(`_parseHashParameters: "${reason.message}".`);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
async _initializeL10n() {
|
||||
|
@ -2085,17 +2087,18 @@ async function loadFakeWorker() {
|
|||
_pdfjsLib.GlobalWorkerOptions.workerSrc = _app_options.AppOptions.get("workerSrc");
|
||||
}
|
||||
|
||||
return (0, _pdfjsLib.loadScript)(_pdfjsLib.PDFWorker.getWorkerSrc());
|
||||
await (0, _pdfjsLib.loadScript)(_pdfjsLib.PDFWorker.workerSrc);
|
||||
}
|
||||
|
||||
function loadAndEnablePDFBug(enabledTabs) {
|
||||
const appConfig = PDFViewerApplication.appConfig;
|
||||
return (0, _pdfjsLib.loadScript)(appConfig.debuggerScriptPath).then(function () {
|
||||
PDFBug.enable(enabledTabs);
|
||||
PDFBug.init({
|
||||
OPS: _pdfjsLib.OPS
|
||||
}, appConfig.mainContainer);
|
||||
});
|
||||
async function initPDFBug(enabledTabs) {
|
||||
const {
|
||||
debuggerScriptPath,
|
||||
mainContainer
|
||||
} = PDFViewerApplication.appConfig;
|
||||
await (0, _pdfjsLib.loadScript)(debuggerScriptPath);
|
||||
PDFBug.init({
|
||||
OPS: _pdfjsLib.OPS
|
||||
}, mainContainer, enabledTabs);
|
||||
}
|
||||
|
||||
function reportPageStatsPDFBug({
|
||||
|
@ -9566,9 +9569,11 @@ var _pdf_link_service = __webpack_require__(18);
|
|||
|
||||
var _struct_tree_layer_builder = __webpack_require__(31);
|
||||
|
||||
var _text_layer_builder = __webpack_require__(32);
|
||||
var _text_highlighter = __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;
|
||||
|
||||
|
@ -9632,13 +9637,12 @@ class BaseViewer {
|
|||
throw new Error("Cannot initialize BaseViewer.");
|
||||
}
|
||||
|
||||
const viewerVersion = '2.11.91';
|
||||
const viewerVersion = '2.11.142';
|
||||
|
||||
if (_pdfjsLib.version !== viewerVersion) {
|
||||
throw new Error(`The API version "${_pdfjsLib.version}" does not match the Viewer version "${viewerVersion}".`);
|
||||
}
|
||||
|
||||
this._name = this.constructor.name;
|
||||
this.container = options.container;
|
||||
this.viewer = options.viewer || options.container.firstElementChild;
|
||||
this.eventBus = options.eventBus;
|
||||
|
@ -9718,7 +9722,7 @@ class BaseViewer {
|
|||
}
|
||||
|
||||
if (!this._setCurrentPageNumber(val, true)) {
|
||||
console.error(`${this._name}.currentPageNumber: "${val}" is not a valid page.`);
|
||||
console.error(`currentPageNumber: "${val}" is not a valid page.`);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9771,7 +9775,7 @@ class BaseViewer {
|
|||
}
|
||||
|
||||
if (!this._setCurrentPageNumber(page, true)) {
|
||||
console.error(`${this._name}.currentPageLabel: "${val}" is not a valid page.`);
|
||||
console.error(`currentPageLabel: "${val}" is not a valid page.`);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9944,7 +9948,7 @@ class BaseViewer {
|
|||
const viewport = firstPdfPage.getViewport({
|
||||
scale: scale * _ui_utils.CSS_UNITS
|
||||
});
|
||||
const textLayerFactory = this.textLayerMode !== _ui_utils.TextLayerMode.DISABLE ? this : null;
|
||||
const textLayerFactory = this.textLayerMode !== _ui_utils.TextLayerMode.DISABLE && !isPureXfa ? this : null;
|
||||
const xfaLayerFactory = isPureXfa ? this : null;
|
||||
|
||||
for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) {
|
||||
|
@ -9960,6 +9964,7 @@ class BaseViewer {
|
|||
textLayerMode: this.textLayerMode,
|
||||
annotationLayerFactory: this,
|
||||
xfaLayerFactory,
|
||||
textHighlighterFactory: this,
|
||||
structTreeLayerFactory: this,
|
||||
imageResourcesPath: this.imageResourcesPath,
|
||||
renderInteractiveForms: this.renderInteractiveForms,
|
||||
|
@ -10050,7 +10055,7 @@ class BaseViewer {
|
|||
this._pageLabels = null;
|
||||
} else if (!(Array.isArray(labels) && this.pdfDocument.numPages === labels.length)) {
|
||||
this._pageLabels = null;
|
||||
console.error(`${this._name}.setPageLabels: Invalid page labels.`);
|
||||
console.error(`setPageLabels: Invalid page labels.`);
|
||||
} else {
|
||||
this._pageLabels = labels;
|
||||
}
|
||||
|
@ -10216,7 +10221,7 @@ class BaseViewer {
|
|||
break;
|
||||
|
||||
default:
|
||||
console.error(`${this._name}._setScale: "${value}" is an unknown zoom value.`);
|
||||
console.error(`_setScale: "${value}" is an unknown zoom value.`);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -10263,7 +10268,7 @@ class BaseViewer {
|
|||
const pageView = Number.isInteger(pageNumber) && this._pages[pageNumber - 1];
|
||||
|
||||
if (!pageView) {
|
||||
console.error(`${this._name}.scrollPageIntoView: ` + `"${pageNumber}" is not a valid pageNumber parameter.`);
|
||||
console.error(`scrollPageIntoView: "${pageNumber}" is not a valid pageNumber parameter.`);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -10333,7 +10338,7 @@ class BaseViewer {
|
|||
break;
|
||||
|
||||
default:
|
||||
console.error(`${this._name}.scrollPageIntoView: ` + `"${destArray[1].name}" is not a valid destination type.`);
|
||||
console.error(`scrollPageIntoView: "${destArray[1].name}" is not a valid destination type.`);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -10496,7 +10501,7 @@ class BaseViewer {
|
|||
}
|
||||
|
||||
if (!(Number.isInteger(pageNumber) && pageNumber > 0 && pageNumber <= this.pagesCount)) {
|
||||
console.error(`${this._name}.isPageVisible: "${pageNumber}" is not a valid page.`);
|
||||
console.error(`isPageVisible: "${pageNumber}" is not a valid page.`);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -10511,7 +10516,7 @@ class BaseViewer {
|
|||
}
|
||||
|
||||
if (!(Number.isInteger(pageNumber) && pageNumber > 0 && pageNumber <= this.pagesCount)) {
|
||||
console.error(`${this._name}.isPageCached: "${pageNumber}" is not a valid page.`);
|
||||
console.error(`isPageCached: "${pageNumber}" is not a valid page.`);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -10585,14 +10590,22 @@ class BaseViewer {
|
|||
return false;
|
||||
}
|
||||
|
||||
createTextLayerBuilder(textLayerDiv, pageIndex, viewport, enhanceTextSelection = false, eventBus) {
|
||||
createTextLayerBuilder(textLayerDiv, pageIndex, viewport, enhanceTextSelection = false, eventBus, highlighter) {
|
||||
return new _text_layer_builder.TextLayerBuilder({
|
||||
textLayerDiv,
|
||||
eventBus,
|
||||
pageIndex,
|
||||
viewport,
|
||||
findController: this.isInPresentationMode ? null : this.findController,
|
||||
enhanceTextSelection: this.isInPresentationMode ? false : enhanceTextSelection
|
||||
enhanceTextSelection: this.isInPresentationMode ? false : enhanceTextSelection,
|
||||
highlighter
|
||||
});
|
||||
}
|
||||
|
||||
createTextHighlighter(pageIndex, eventBus) {
|
||||
return new _text_highlighter.TextHighlighter({
|
||||
eventBus,
|
||||
pageIndex,
|
||||
findController: this.isInPresentationMode ? null : this.findController
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -11269,6 +11282,7 @@ class PDFPageView {
|
|||
this.textLayerFactory = options.textLayerFactory;
|
||||
this.annotationLayerFactory = options.annotationLayerFactory;
|
||||
this.xfaLayerFactory = options.xfaLayerFactory;
|
||||
this.textHighlighter = options.textHighlighterFactory?.createTextHighlighter(this.id - 1, this.eventBus);
|
||||
this.structTreeLayerFactory = options.structTreeLayerFactory;
|
||||
this.renderer = options.renderer || _ui_utils.RendererType.CANVAS;
|
||||
this.l10n = options.l10n || _l10n_utils.NullL10n;
|
||||
|
@ -11337,7 +11351,11 @@ class PDFPageView {
|
|||
let error = null;
|
||||
|
||||
try {
|
||||
await this.xfaLayer.render(this.viewport, "display");
|
||||
const result = await this.xfaLayer.render(this.viewport, "display");
|
||||
|
||||
if (this.textHighlighter) {
|
||||
this._buildXfaTextContentItems(result.textDivs);
|
||||
}
|
||||
} catch (ex) {
|
||||
error = ex;
|
||||
} finally {
|
||||
|
@ -11349,6 +11367,18 @@ class PDFPageView {
|
|||
}
|
||||
}
|
||||
|
||||
async _buildXfaTextContentItems(textDivs) {
|
||||
const text = await this.pdfPage.getTextContent();
|
||||
const items = [];
|
||||
|
||||
for (const item of text.items) {
|
||||
items.push(item.str);
|
||||
}
|
||||
|
||||
this.textHighlighter.setTextMapping(textDivs, items);
|
||||
this.textHighlighter.enable();
|
||||
}
|
||||
|
||||
_resetZoomLayer(removeFromDOM = false) {
|
||||
if (!this.zoomLayer) {
|
||||
return;
|
||||
|
@ -11540,6 +11570,7 @@ class PDFPageView {
|
|||
if (this.xfaLayer && (!keepXfaLayer || !this.xfaLayer.div)) {
|
||||
this.xfaLayer.cancel();
|
||||
this.xfaLayer = null;
|
||||
this.textHighlighter?.disable();
|
||||
}
|
||||
|
||||
if (this._onTextLayerRendered) {
|
||||
|
@ -11682,7 +11713,7 @@ class PDFPageView {
|
|||
div.appendChild(textLayerDiv);
|
||||
}
|
||||
|
||||
textLayer = this.textLayerFactory.createTextLayerBuilder(textLayerDiv, this.id - 1, this.viewport, this.textLayerMode === _ui_utils.TextLayerMode.ENABLE_ENHANCE, this.eventBus);
|
||||
textLayer = this.textLayerFactory.createTextLayerBuilder(textLayerDiv, this.id - 1, this.viewport, this.textLayerMode === _ui_utils.TextLayerMode.ENABLE_ENHANCE, this.eventBus, this.textHighlighter);
|
||||
}
|
||||
|
||||
this.textLayer = textLayer;
|
||||
|
@ -12067,88 +12098,46 @@ exports.DefaultStructTreeLayerFactory = DefaultStructTreeLayerFactory;
|
|||
|
||||
/***/ }),
|
||||
/* 32 */
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
/***/ ((__unused_webpack_module, exports) => {
|
||||
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({
|
||||
value: true
|
||||
}));
|
||||
exports.TextLayerBuilder = exports.DefaultTextLayerFactory = void 0;
|
||||
exports.TextHighlighter = void 0;
|
||||
|
||||
var _pdfjsLib = __webpack_require__(4);
|
||||
|
||||
const EXPAND_DIVS_TIMEOUT = 300;
|
||||
|
||||
class TextLayerBuilder {
|
||||
class TextHighlighter {
|
||||
constructor({
|
||||
textLayerDiv,
|
||||
findController,
|
||||
eventBus,
|
||||
pageIndex,
|
||||
viewport,
|
||||
findController = null,
|
||||
enhanceTextSelection = false
|
||||
pageIndex
|
||||
}) {
|
||||
this.textLayerDiv = textLayerDiv;
|
||||
this.eventBus = eventBus;
|
||||
this.textContent = null;
|
||||
this.textContentItemsStr = [];
|
||||
this.textContentStream = null;
|
||||
this.renderingDone = false;
|
||||
this.pageIdx = pageIndex;
|
||||
this.pageNumber = this.pageIdx + 1;
|
||||
this.matches = [];
|
||||
this.viewport = viewport;
|
||||
this.textDivs = [];
|
||||
this.findController = findController;
|
||||
this.textLayerRenderTask = null;
|
||||
this.enhanceTextSelection = enhanceTextSelection;
|
||||
this.matches = [];
|
||||
this.eventBus = eventBus;
|
||||
this.pageIdx = pageIndex;
|
||||
this._onUpdateTextLayerMatches = null;
|
||||
|
||||
this._bindMouse();
|
||||
this.textDivs = null;
|
||||
this.textContentItemsStr = null;
|
||||
this.enabled = false;
|
||||
}
|
||||
|
||||
_finishRendering() {
|
||||
this.renderingDone = true;
|
||||
|
||||
if (!this.enhanceTextSelection) {
|
||||
const endOfContent = document.createElement("div");
|
||||
endOfContent.className = "endOfContent";
|
||||
this.textLayerDiv.appendChild(endOfContent);
|
||||
}
|
||||
|
||||
this.eventBus.dispatch("textlayerrendered", {
|
||||
source: this,
|
||||
pageNumber: this.pageNumber,
|
||||
numTextDivs: this.textDivs.length
|
||||
});
|
||||
setTextMapping(divs, texts) {
|
||||
this.textDivs = divs;
|
||||
this.textContentItemsStr = texts;
|
||||
}
|
||||
|
||||
render(timeout = 0) {
|
||||
if (!(this.textContent || this.textContentStream) || this.renderingDone) {
|
||||
return;
|
||||
enable() {
|
||||
if (!this.textDivs || !this.textContentItemsStr) {
|
||||
throw new Error("Text divs and strings have not been set.");
|
||||
}
|
||||
|
||||
this.cancel();
|
||||
this.textDivs = [];
|
||||
const textLayerFrag = document.createDocumentFragment();
|
||||
this.textLayerRenderTask = (0, _pdfjsLib.renderTextLayer)({
|
||||
textContent: this.textContent,
|
||||
textContentStream: this.textContentStream,
|
||||
container: textLayerFrag,
|
||||
viewport: this.viewport,
|
||||
textDivs: this.textDivs,
|
||||
textContentItemsStr: this.textContentItemsStr,
|
||||
timeout,
|
||||
enhanceTextSelection: this.enhanceTextSelection
|
||||
});
|
||||
this.textLayerRenderTask.promise.then(() => {
|
||||
this.textLayerDiv.appendChild(textLayerFrag);
|
||||
if (this.enabled) {
|
||||
throw new Error("TextHighlighter is already enabled.");
|
||||
}
|
||||
|
||||
this._finishRendering();
|
||||
|
||||
this._updateMatches();
|
||||
}, function (reason) {});
|
||||
this.enabled = true;
|
||||
|
||||
if (!this._onUpdateTextLayerMatches) {
|
||||
this._onUpdateTextLayerMatches = evt => {
|
||||
|
@ -12159,14 +12148,17 @@ class TextLayerBuilder {
|
|||
|
||||
this.eventBus._on("updatetextlayermatches", this._onUpdateTextLayerMatches);
|
||||
}
|
||||
|
||||
this._updateMatches();
|
||||
}
|
||||
|
||||
cancel() {
|
||||
if (this.textLayerRenderTask) {
|
||||
this.textLayerRenderTask.cancel();
|
||||
this.textLayerRenderTask = null;
|
||||
disable() {
|
||||
if (!this.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.enabled = false;
|
||||
|
||||
if (this._onUpdateTextLayerMatches) {
|
||||
this.eventBus._off("updatetextlayermatches", this._onUpdateTextLayerMatches);
|
||||
|
||||
|
@ -12174,16 +12166,6 @@ class TextLayerBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
setTextContentStream(readableStream) {
|
||||
this.cancel();
|
||||
this.textContentStream = readableStream;
|
||||
}
|
||||
|
||||
setTextContent(textContent) {
|
||||
this.cancel();
|
||||
this.textContent = textContent;
|
||||
}
|
||||
|
||||
_convertMatches(matches, matchesLength) {
|
||||
if (!matches) {
|
||||
return [];
|
||||
|
@ -12239,7 +12221,9 @@ class TextLayerBuilder {
|
|||
|
||||
const {
|
||||
findController,
|
||||
pageIdx,
|
||||
pageIdx
|
||||
} = this;
|
||||
const {
|
||||
textContentItemsStr,
|
||||
textDivs
|
||||
} = this;
|
||||
|
@ -12259,7 +12243,16 @@ class TextLayerBuilder {
|
|||
}
|
||||
|
||||
function appendTextToDiv(divIdx, fromOffset, toOffset, className) {
|
||||
const div = textDivs[divIdx];
|
||||
let div = textDivs[divIdx];
|
||||
|
||||
if (div.nodeType === 3) {
|
||||
const span = document.createElement("span");
|
||||
div.parentNode.insertBefore(span, div);
|
||||
span.appendChild(div);
|
||||
textDivs[divIdx] = span;
|
||||
div = span;
|
||||
}
|
||||
|
||||
const content = textContentItemsStr[divIdx].substring(fromOffset, toOffset);
|
||||
const node = document.createTextNode(content);
|
||||
|
||||
|
@ -12333,14 +12326,16 @@ class TextLayerBuilder {
|
|||
}
|
||||
|
||||
_updateMatches() {
|
||||
if (!this.renderingDone) {
|
||||
if (!this.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
const {
|
||||
findController,
|
||||
matches,
|
||||
pageIdx,
|
||||
pageIdx
|
||||
} = this;
|
||||
const {
|
||||
textContentItemsStr,
|
||||
textDivs
|
||||
} = this;
|
||||
|
@ -12370,6 +12365,119 @@ class TextLayerBuilder {
|
|||
this._renderMatches(this.matches);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.TextHighlighter = TextHighlighter;
|
||||
|
||||
/***/ }),
|
||||
/* 33 */
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({
|
||||
value: true
|
||||
}));
|
||||
exports.TextLayerBuilder = exports.DefaultTextLayerFactory = void 0;
|
||||
|
||||
var _pdfjsLib = __webpack_require__(4);
|
||||
|
||||
const EXPAND_DIVS_TIMEOUT = 300;
|
||||
|
||||
class TextLayerBuilder {
|
||||
constructor({
|
||||
textLayerDiv,
|
||||
eventBus,
|
||||
pageIndex,
|
||||
viewport,
|
||||
highlighter = null,
|
||||
enhanceTextSelection = false
|
||||
}) {
|
||||
this.textLayerDiv = textLayerDiv;
|
||||
this.eventBus = eventBus;
|
||||
this.textContent = null;
|
||||
this.textContentItemsStr = [];
|
||||
this.textContentStream = null;
|
||||
this.renderingDone = false;
|
||||
this.pageIdx = pageIndex;
|
||||
this.pageNumber = this.pageIdx + 1;
|
||||
this.matches = [];
|
||||
this.viewport = viewport;
|
||||
this.textDivs = [];
|
||||
this.textLayerRenderTask = null;
|
||||
this.highlighter = highlighter;
|
||||
this.enhanceTextSelection = enhanceTextSelection;
|
||||
|
||||
this._bindMouse();
|
||||
}
|
||||
|
||||
_finishRendering() {
|
||||
this.renderingDone = true;
|
||||
|
||||
if (!this.enhanceTextSelection) {
|
||||
const endOfContent = document.createElement("div");
|
||||
endOfContent.className = "endOfContent";
|
||||
this.textLayerDiv.appendChild(endOfContent);
|
||||
}
|
||||
|
||||
this.eventBus.dispatch("textlayerrendered", {
|
||||
source: this,
|
||||
pageNumber: this.pageNumber,
|
||||
numTextDivs: this.textDivs.length
|
||||
});
|
||||
}
|
||||
|
||||
render(timeout = 0) {
|
||||
if (!(this.textContent || this.textContentStream) || this.renderingDone) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.cancel();
|
||||
this.textDivs = [];
|
||||
|
||||
if (this.highlighter) {
|
||||
this.highlighter.setTextMapping(this.textDivs, this.textContentItemsStr);
|
||||
}
|
||||
|
||||
const textLayerFrag = document.createDocumentFragment();
|
||||
this.textLayerRenderTask = (0, _pdfjsLib.renderTextLayer)({
|
||||
textContent: this.textContent,
|
||||
textContentStream: this.textContentStream,
|
||||
container: textLayerFrag,
|
||||
viewport: this.viewport,
|
||||
textDivs: this.textDivs,
|
||||
textContentItemsStr: this.textContentItemsStr,
|
||||
timeout,
|
||||
enhanceTextSelection: this.enhanceTextSelection
|
||||
});
|
||||
this.textLayerRenderTask.promise.then(() => {
|
||||
this.textLayerDiv.appendChild(textLayerFrag);
|
||||
|
||||
this._finishRendering();
|
||||
|
||||
this.highlighter?.enable();
|
||||
}, function (reason) {});
|
||||
}
|
||||
|
||||
cancel() {
|
||||
if (this.textLayerRenderTask) {
|
||||
this.textLayerRenderTask.cancel();
|
||||
this.textLayerRenderTask = null;
|
||||
}
|
||||
|
||||
this.highlighter?.disable();
|
||||
}
|
||||
|
||||
setTextContentStream(readableStream) {
|
||||
this.cancel();
|
||||
this.textContentStream = readableStream;
|
||||
}
|
||||
|
||||
setTextContent(textContent) {
|
||||
this.cancel();
|
||||
this.textContent = textContent;
|
||||
}
|
||||
|
||||
_bindMouse() {
|
||||
const div = this.textLayerDiv;
|
||||
let expandDivsTimer = null;
|
||||
|
@ -12408,7 +12516,7 @@ class TextLayerBuilder {
|
|||
exports.TextLayerBuilder = TextLayerBuilder;
|
||||
|
||||
class DefaultTextLayerFactory {
|
||||
createTextLayerBuilder(textLayerDiv, pageIndex, viewport, enhanceTextSelection = false, eventBus) {
|
||||
createTextLayerBuilder(textLayerDiv, pageIndex, viewport, enhanceTextSelection = false, eventBus, highlighter) {
|
||||
return new TextLayerBuilder({
|
||||
textLayerDiv,
|
||||
pageIndex,
|
||||
|
@ -12423,7 +12531,7 @@ class DefaultTextLayerFactory {
|
|||
exports.DefaultTextLayerFactory = DefaultTextLayerFactory;
|
||||
|
||||
/***/ }),
|
||||
/* 33 */
|
||||
/* 34 */
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
|
@ -12473,7 +12581,7 @@ class XfaLayerBuilder {
|
|||
|
||||
return this.pdfPage.getXfa().then(xfa => {
|
||||
if (this._cancelled) {
|
||||
return;
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
const parameters = {
|
||||
|
@ -12488,14 +12596,13 @@ class XfaLayerBuilder {
|
|||
};
|
||||
|
||||
if (this.div) {
|
||||
_pdfjsLib.XfaLayer.update(parameters);
|
||||
} else {
|
||||
this.div = document.createElement("div");
|
||||
this.pageDiv.appendChild(this.div);
|
||||
parameters.div = this.div;
|
||||
|
||||
_pdfjsLib.XfaLayer.render(parameters);
|
||||
return _pdfjsLib.XfaLayer.update(parameters);
|
||||
}
|
||||
|
||||
this.div = document.createElement("div");
|
||||
this.pageDiv.appendChild(this.div);
|
||||
parameters.div = this.div;
|
||||
return _pdfjsLib.XfaLayer.render(parameters);
|
||||
}).catch(error => {
|
||||
console.error(error);
|
||||
});
|
||||
|
@ -12532,7 +12639,7 @@ class DefaultXfaLayerFactory {
|
|||
exports.DefaultXfaLayerFactory = DefaultXfaLayerFactory;
|
||||
|
||||
/***/ }),
|
||||
/* 34 */
|
||||
/* 35 */
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
|
@ -12546,7 +12653,7 @@ var _ui_utils = __webpack_require__(3);
|
|||
|
||||
var _pdf_cursor_tools = __webpack_require__(5);
|
||||
|
||||
var _pdf_single_page_viewer = __webpack_require__(35);
|
||||
var _pdf_single_page_viewer = __webpack_require__(36);
|
||||
|
||||
class SecondaryToolbar {
|
||||
constructor(options, mainContainer, eventBus) {
|
||||
|
@ -12851,7 +12958,7 @@ class SecondaryToolbar {
|
|||
exports.SecondaryToolbar = SecondaryToolbar;
|
||||
|
||||
/***/ }),
|
||||
/* 35 */
|
||||
/* 36 */
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
|
@ -12980,7 +13087,7 @@ class PDFSinglePageViewer extends _base_viewer.BaseViewer {
|
|||
exports.PDFSinglePageViewer = PDFSinglePageViewer;
|
||||
|
||||
/***/ }),
|
||||
/* 36 */
|
||||
/* 37 */
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
|
@ -13255,7 +13362,7 @@ class Toolbar {
|
|||
exports.Toolbar = Toolbar;
|
||||
|
||||
/***/ }),
|
||||
/* 37 */
|
||||
/* 38 */
|
||||
/***/ ((__unused_webpack_module, exports) => {
|
||||
|
||||
|
||||
|
@ -13350,7 +13457,7 @@ class ViewHistory {
|
|||
exports.ViewHistory = ViewHistory;
|
||||
|
||||
/***/ }),
|
||||
/* 38 */
|
||||
/* 39 */
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
|
@ -13360,13 +13467,13 @@ Object.defineProperty(exports, "__esModule", ({
|
|||
}));
|
||||
exports.FirefoxCom = exports.DownloadManager = void 0;
|
||||
|
||||
__webpack_require__(39);
|
||||
__webpack_require__(40);
|
||||
|
||||
var _app = __webpack_require__(2);
|
||||
|
||||
var _pdfjsLib = __webpack_require__(4);
|
||||
|
||||
var _preferences = __webpack_require__(40);
|
||||
var _preferences = __webpack_require__(41);
|
||||
|
||||
var _ui_utils = __webpack_require__(3);
|
||||
|
||||
|
@ -13774,7 +13881,7 @@ document.mozL10n.setExternalLocalizerServices({
|
|||
});
|
||||
|
||||
/***/ }),
|
||||
/* 39 */
|
||||
/* 40 */
|
||||
/***/ (() => {
|
||||
|
||||
|
||||
|
@ -13896,7 +14003,7 @@ document.mozL10n.setExternalLocalizerServices({
|
|||
})(void 0);
|
||||
|
||||
/***/ }),
|
||||
/* 40 */
|
||||
/* 41 */
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
|
@ -14028,7 +14135,7 @@ class BasePreferences {
|
|||
exports.BasePreferences = BasePreferences;
|
||||
|
||||
/***/ }),
|
||||
/* 41 */
|
||||
/* 42 */
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
|
@ -14040,7 +14147,7 @@ exports.FirefoxPrintService = FirefoxPrintService;
|
|||
|
||||
var _pdfjsLib = __webpack_require__(4);
|
||||
|
||||
var _print_utils = __webpack_require__(42);
|
||||
var _print_utils = __webpack_require__(43);
|
||||
|
||||
var _app = __webpack_require__(2);
|
||||
|
||||
|
@ -14157,7 +14264,7 @@ _app.PDFPrintServiceFactory.instance = {
|
|||
};
|
||||
|
||||
/***/ }),
|
||||
/* 42 */
|
||||
/* 43 */
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
|
@ -14169,7 +14276,7 @@ exports.getXfaHtmlForPrinting = getXfaHtmlForPrinting;
|
|||
|
||||
var _ui_utils = __webpack_require__(3);
|
||||
|
||||
var _xfa_layer_builder = __webpack_require__(33);
|
||||
var _xfa_layer_builder = __webpack_require__(34);
|
||||
|
||||
var _pdfjsLib = __webpack_require__(4);
|
||||
|
||||
|
@ -14244,15 +14351,15 @@ var _app_options = __webpack_require__(1);
|
|||
|
||||
var _app = __webpack_require__(2);
|
||||
|
||||
const pdfjsVersion = '2.11.91';
|
||||
const pdfjsBuild = '3d18c76a5';
|
||||
const pdfjsVersion = '2.11.142';
|
||||
const pdfjsBuild = '56e7bb626';
|
||||
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.11.91
|
||||
release: version 2.11.142
|
||||
|
||||
# The package's license, where possible using the mnemonic from
|
||||
# https://spdx.org/licenses/
|
||||
|
|
Загрузка…
Ссылка в новой задаче