Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/wp-conte.../plugins/embedpre.../assets/pdf/build
File: script.js
this._setupFakeWorker();
[16500] Fix | Delete
}
[16501] Fix | Delete
_setupFakeWorker() {
[16502] Fix | Delete
if (!PDFWorkerUtil.isWorkerDisabled) {
[16503] Fix | Delete
warn("Setting up fake worker.");
[16504] Fix | Delete
PDFWorkerUtil.isWorkerDisabled = true;
[16505] Fix | Delete
}
[16506] Fix | Delete
PDFWorker._setupFakeWorkerGlobal.then(WorkerMessageHandler => {
[16507] Fix | Delete
if (this.destroyed) {
[16508] Fix | Delete
this._readyCapability.reject(new Error("Worker was destroyed"));
[16509] Fix | Delete
return;
[16510] Fix | Delete
}
[16511] Fix | Delete
const port = new LoopbackPort();
[16512] Fix | Delete
this._port = port;
[16513] Fix | Delete
const id = `fake${PDFWorkerUtil.fakeWorkerId++}`;
[16514] Fix | Delete
const workerHandler = new MessageHandler(id + "_worker", id, port);
[16515] Fix | Delete
WorkerMessageHandler.setup(workerHandler, port);
[16516] Fix | Delete
const messageHandler = new MessageHandler(id, id + "_worker", port);
[16517] Fix | Delete
this._messageHandler = messageHandler;
[16518] Fix | Delete
this._readyCapability.resolve();
[16519] Fix | Delete
messageHandler.send("configure", {
[16520] Fix | Delete
verbosity: this.verbosity
[16521] Fix | Delete
});
[16522] Fix | Delete
}).catch(reason => {
[16523] Fix | Delete
this._readyCapability.reject(new Error(`Setting up fake worker failed: "${reason.message}".`));
[16524] Fix | Delete
});
[16525] Fix | Delete
}
[16526] Fix | Delete
destroy() {
[16527] Fix | Delete
this.destroyed = true;
[16528] Fix | Delete
if (this._webWorker) {
[16529] Fix | Delete
this._webWorker.terminate();
[16530] Fix | Delete
this._webWorker = null;
[16531] Fix | Delete
}
[16532] Fix | Delete
PDFWorker.#workerPorts?.delete(this._port);
[16533] Fix | Delete
this._port = null;
[16534] Fix | Delete
if (this._messageHandler) {
[16535] Fix | Delete
this._messageHandler.destroy();
[16536] Fix | Delete
this._messageHandler = null;
[16537] Fix | Delete
}
[16538] Fix | Delete
}
[16539] Fix | Delete
static fromPort(params) {
[16540] Fix | Delete
if (!params?.port) {
[16541] Fix | Delete
throw new Error("PDFWorker.fromPort - invalid method signature.");
[16542] Fix | Delete
}
[16543] Fix | Delete
const cachedPort = this.#workerPorts?.get(params.port);
[16544] Fix | Delete
if (cachedPort) {
[16545] Fix | Delete
if (cachedPort._pendingDestroy) {
[16546] Fix | Delete
throw new Error("PDFWorker.fromPort - the worker is being destroyed.\n" + "Please remember to await `PDFDocumentLoadingTask.destroy()`-calls.");
[16547] Fix | Delete
}
[16548] Fix | Delete
return cachedPort;
[16549] Fix | Delete
}
[16550] Fix | Delete
return new PDFWorker(params);
[16551] Fix | Delete
}
[16552] Fix | Delete
static get workerSrc() {
[16553] Fix | Delete
if (GlobalWorkerOptions.workerSrc) {
[16554] Fix | Delete
return GlobalWorkerOptions.workerSrc;
[16555] Fix | Delete
}
[16556] Fix | Delete
throw new Error('No "GlobalWorkerOptions.workerSrc" specified.');
[16557] Fix | Delete
}
[16558] Fix | Delete
static get #mainThreadWorkerMessageHandler() {
[16559] Fix | Delete
try {
[16560] Fix | Delete
return globalThis.pdfjsWorker?.WorkerMessageHandler || null;
[16561] Fix | Delete
} catch {
[16562] Fix | Delete
return null;
[16563] Fix | Delete
}
[16564] Fix | Delete
}
[16565] Fix | Delete
static get _setupFakeWorkerGlobal() {
[16566] Fix | Delete
const loader = async () => {
[16567] Fix | Delete
if (this.#mainThreadWorkerMessageHandler) {
[16568] Fix | Delete
return this.#mainThreadWorkerMessageHandler;
[16569] Fix | Delete
}
[16570] Fix | Delete
const worker = await import( /*webpackIgnore: true*/this.workerSrc);
[16571] Fix | Delete
return worker.WorkerMessageHandler;
[16572] Fix | Delete
};
[16573] Fix | Delete
return shadow(this, "_setupFakeWorkerGlobal", loader());
[16574] Fix | Delete
}
[16575] Fix | Delete
}
[16576] Fix | Delete
class WorkerTransport {
[16577] Fix | Delete
#methodPromises = new Map();
[16578] Fix | Delete
#pageCache = new Map();
[16579] Fix | Delete
#pagePromises = new Map();
[16580] Fix | Delete
#pageRefCache = new Map();
[16581] Fix | Delete
#passwordCapability = null;
[16582] Fix | Delete
constructor(messageHandler, loadingTask, networkStream, params, factory) {
[16583] Fix | Delete
this.messageHandler = messageHandler;
[16584] Fix | Delete
this.loadingTask = loadingTask;
[16585] Fix | Delete
this.commonObjs = new PDFObjects();
[16586] Fix | Delete
this.fontLoader = new FontLoader({
[16587] Fix | Delete
ownerDocument: params.ownerDocument,
[16588] Fix | Delete
styleElement: params.styleElement
[16589] Fix | Delete
});
[16590] Fix | Delete
this.loadingParams = params.loadingParams;
[16591] Fix | Delete
this._params = params;
[16592] Fix | Delete
this.canvasFactory = factory.canvasFactory;
[16593] Fix | Delete
this.filterFactory = factory.filterFactory;
[16594] Fix | Delete
this.cMapReaderFactory = factory.cMapReaderFactory;
[16595] Fix | Delete
this.standardFontDataFactory = factory.standardFontDataFactory;
[16596] Fix | Delete
this.destroyed = false;
[16597] Fix | Delete
this.destroyCapability = null;
[16598] Fix | Delete
this._networkStream = networkStream;
[16599] Fix | Delete
this._fullReader = null;
[16600] Fix | Delete
this._lastProgress = null;
[16601] Fix | Delete
this.downloadInfoCapability = Promise.withResolvers();
[16602] Fix | Delete
this.setupMessageHandler();
[16603] Fix | Delete
}
[16604] Fix | Delete
#cacheSimpleMethod(name, data = null) {
[16605] Fix | Delete
const cachedPromise = this.#methodPromises.get(name);
[16606] Fix | Delete
if (cachedPromise) {
[16607] Fix | Delete
return cachedPromise;
[16608] Fix | Delete
}
[16609] Fix | Delete
const promise = this.messageHandler.sendWithPromise(name, data);
[16610] Fix | Delete
this.#methodPromises.set(name, promise);
[16611] Fix | Delete
return promise;
[16612] Fix | Delete
}
[16613] Fix | Delete
get annotationStorage() {
[16614] Fix | Delete
return shadow(this, "annotationStorage", new AnnotationStorage());
[16615] Fix | Delete
}
[16616] Fix | Delete
getRenderingIntent(intent, annotationMode = AnnotationMode.ENABLE, printAnnotationStorage = null, isOpList = false) {
[16617] Fix | Delete
let renderingIntent = RenderingIntentFlag.DISPLAY;
[16618] Fix | Delete
let annotationStorageSerializable = SerializableEmpty;
[16619] Fix | Delete
switch (intent) {
[16620] Fix | Delete
case "any":
[16621] Fix | Delete
renderingIntent = RenderingIntentFlag.ANY;
[16622] Fix | Delete
break;
[16623] Fix | Delete
case "display":
[16624] Fix | Delete
break;
[16625] Fix | Delete
case "print":
[16626] Fix | Delete
renderingIntent = RenderingIntentFlag.PRINT;
[16627] Fix | Delete
break;
[16628] Fix | Delete
default:
[16629] Fix | Delete
warn(`getRenderingIntent - invalid intent: ${intent}`);
[16630] Fix | Delete
}
[16631] Fix | Delete
switch (annotationMode) {
[16632] Fix | Delete
case AnnotationMode.DISABLE:
[16633] Fix | Delete
renderingIntent += RenderingIntentFlag.ANNOTATIONS_DISABLE;
[16634] Fix | Delete
break;
[16635] Fix | Delete
case AnnotationMode.ENABLE:
[16636] Fix | Delete
break;
[16637] Fix | Delete
case AnnotationMode.ENABLE_FORMS:
[16638] Fix | Delete
renderingIntent += RenderingIntentFlag.ANNOTATIONS_FORMS;
[16639] Fix | Delete
break;
[16640] Fix | Delete
case AnnotationMode.ENABLE_STORAGE:
[16641] Fix | Delete
renderingIntent += RenderingIntentFlag.ANNOTATIONS_STORAGE;
[16642] Fix | Delete
const annotationStorage = renderingIntent & RenderingIntentFlag.PRINT && printAnnotationStorage instanceof PrintAnnotationStorage ? printAnnotationStorage : this.annotationStorage;
[16643] Fix | Delete
annotationStorageSerializable = annotationStorage.serializable;
[16644] Fix | Delete
break;
[16645] Fix | Delete
default:
[16646] Fix | Delete
warn(`getRenderingIntent - invalid annotationMode: ${annotationMode}`);
[16647] Fix | Delete
}
[16648] Fix | Delete
if (isOpList) {
[16649] Fix | Delete
renderingIntent += RenderingIntentFlag.OPLIST;
[16650] Fix | Delete
}
[16651] Fix | Delete
return {
[16652] Fix | Delete
renderingIntent,
[16653] Fix | Delete
cacheKey: `${renderingIntent}_${annotationStorageSerializable.hash}`,
[16654] Fix | Delete
annotationStorageSerializable
[16655] Fix | Delete
};
[16656] Fix | Delete
}
[16657] Fix | Delete
destroy() {
[16658] Fix | Delete
if (this.destroyCapability) {
[16659] Fix | Delete
return this.destroyCapability.promise;
[16660] Fix | Delete
}
[16661] Fix | Delete
this.destroyed = true;
[16662] Fix | Delete
this.destroyCapability = Promise.withResolvers();
[16663] Fix | Delete
this.#passwordCapability?.reject(new Error("Worker was destroyed during onPassword callback"));
[16664] Fix | Delete
const waitOn = [];
[16665] Fix | Delete
for (const page of this.#pageCache.values()) {
[16666] Fix | Delete
waitOn.push(page._destroy());
[16667] Fix | Delete
}
[16668] Fix | Delete
this.#pageCache.clear();
[16669] Fix | Delete
this.#pagePromises.clear();
[16670] Fix | Delete
this.#pageRefCache.clear();
[16671] Fix | Delete
if (this.hasOwnProperty("annotationStorage")) {
[16672] Fix | Delete
this.annotationStorage.resetModified();
[16673] Fix | Delete
}
[16674] Fix | Delete
const terminated = this.messageHandler.sendWithPromise("Terminate", null);
[16675] Fix | Delete
waitOn.push(terminated);
[16676] Fix | Delete
Promise.all(waitOn).then(() => {
[16677] Fix | Delete
this.commonObjs.clear();
[16678] Fix | Delete
this.fontLoader.clear();
[16679] Fix | Delete
this.#methodPromises.clear();
[16680] Fix | Delete
this.filterFactory.destroy();
[16681] Fix | Delete
TextLayer.cleanup();
[16682] Fix | Delete
this._networkStream?.cancelAllRequests(new AbortException("Worker was terminated."));
[16683] Fix | Delete
if (this.messageHandler) {
[16684] Fix | Delete
this.messageHandler.destroy();
[16685] Fix | Delete
this.messageHandler = null;
[16686] Fix | Delete
}
[16687] Fix | Delete
this.destroyCapability.resolve();
[16688] Fix | Delete
}, this.destroyCapability.reject);
[16689] Fix | Delete
return this.destroyCapability.promise;
[16690] Fix | Delete
}
[16691] Fix | Delete
setupMessageHandler() {
[16692] Fix | Delete
const {
[16693] Fix | Delete
messageHandler,
[16694] Fix | Delete
loadingTask
[16695] Fix | Delete
} = this;
[16696] Fix | Delete
messageHandler.on("GetReader", (data, sink) => {
[16697] Fix | Delete
assert(this._networkStream, "GetReader - no `IPDFStream` instance available.");
[16698] Fix | Delete
this._fullReader = this._networkStream.getFullReader();
[16699] Fix | Delete
this._fullReader.onProgress = evt => {
[16700] Fix | Delete
this._lastProgress = {
[16701] Fix | Delete
loaded: evt.loaded,
[16702] Fix | Delete
total: evt.total
[16703] Fix | Delete
};
[16704] Fix | Delete
};
[16705] Fix | Delete
sink.onPull = () => {
[16706] Fix | Delete
this._fullReader.read().then(function ({
[16707] Fix | Delete
value,
[16708] Fix | Delete
done
[16709] Fix | Delete
}) {
[16710] Fix | Delete
if (done) {
[16711] Fix | Delete
sink.close();
[16712] Fix | Delete
return;
[16713] Fix | Delete
}
[16714] Fix | Delete
assert(value instanceof ArrayBuffer, "GetReader - expected an ArrayBuffer.");
[16715] Fix | Delete
sink.enqueue(new Uint8Array(value), 1, [value]);
[16716] Fix | Delete
}).catch(reason => {
[16717] Fix | Delete
sink.error(reason);
[16718] Fix | Delete
});
[16719] Fix | Delete
};
[16720] Fix | Delete
sink.onCancel = reason => {
[16721] Fix | Delete
this._fullReader.cancel(reason);
[16722] Fix | Delete
sink.ready.catch(readyReason => {
[16723] Fix | Delete
if (this.destroyed) {
[16724] Fix | Delete
return;
[16725] Fix | Delete
}
[16726] Fix | Delete
throw readyReason;
[16727] Fix | Delete
});
[16728] Fix | Delete
};
[16729] Fix | Delete
});
[16730] Fix | Delete
messageHandler.on("ReaderHeadersReady", data => {
[16731] Fix | Delete
const headersCapability = Promise.withResolvers();
[16732] Fix | Delete
const fullReader = this._fullReader;
[16733] Fix | Delete
fullReader.headersReady.then(() => {
[16734] Fix | Delete
if (!fullReader.isStreamingSupported || !fullReader.isRangeSupported) {
[16735] Fix | Delete
if (this._lastProgress) {
[16736] Fix | Delete
loadingTask.onProgress?.(this._lastProgress);
[16737] Fix | Delete
}
[16738] Fix | Delete
fullReader.onProgress = evt => {
[16739] Fix | Delete
loadingTask.onProgress?.({
[16740] Fix | Delete
loaded: evt.loaded,
[16741] Fix | Delete
total: evt.total
[16742] Fix | Delete
});
[16743] Fix | Delete
};
[16744] Fix | Delete
}
[16745] Fix | Delete
headersCapability.resolve({
[16746] Fix | Delete
isStreamingSupported: fullReader.isStreamingSupported,
[16747] Fix | Delete
isRangeSupported: fullReader.isRangeSupported,
[16748] Fix | Delete
contentLength: fullReader.contentLength
[16749] Fix | Delete
});
[16750] Fix | Delete
}, headersCapability.reject);
[16751] Fix | Delete
return headersCapability.promise;
[16752] Fix | Delete
});
[16753] Fix | Delete
messageHandler.on("GetRangeReader", (data, sink) => {
[16754] Fix | Delete
assert(this._networkStream, "GetRangeReader - no `IPDFStream` instance available.");
[16755] Fix | Delete
const rangeReader = this._networkStream.getRangeReader(data.begin, data.end);
[16756] Fix | Delete
if (!rangeReader) {
[16757] Fix | Delete
sink.close();
[16758] Fix | Delete
return;
[16759] Fix | Delete
}
[16760] Fix | Delete
sink.onPull = () => {
[16761] Fix | Delete
rangeReader.read().then(function ({
[16762] Fix | Delete
value,
[16763] Fix | Delete
done
[16764] Fix | Delete
}) {
[16765] Fix | Delete
if (done) {
[16766] Fix | Delete
sink.close();
[16767] Fix | Delete
return;
[16768] Fix | Delete
}
[16769] Fix | Delete
assert(value instanceof ArrayBuffer, "GetRangeReader - expected an ArrayBuffer.");
[16770] Fix | Delete
sink.enqueue(new Uint8Array(value), 1, [value]);
[16771] Fix | Delete
}).catch(reason => {
[16772] Fix | Delete
sink.error(reason);
[16773] Fix | Delete
});
[16774] Fix | Delete
};
[16775] Fix | Delete
sink.onCancel = reason => {
[16776] Fix | Delete
rangeReader.cancel(reason);
[16777] Fix | Delete
sink.ready.catch(readyReason => {
[16778] Fix | Delete
if (this.destroyed) {
[16779] Fix | Delete
return;
[16780] Fix | Delete
}
[16781] Fix | Delete
throw readyReason;
[16782] Fix | Delete
});
[16783] Fix | Delete
};
[16784] Fix | Delete
});
[16785] Fix | Delete
messageHandler.on("GetDoc", ({
[16786] Fix | Delete
pdfInfo
[16787] Fix | Delete
}) => {
[16788] Fix | Delete
this._numPages = pdfInfo.numPages;
[16789] Fix | Delete
this._htmlForXfa = pdfInfo.htmlForXfa;
[16790] Fix | Delete
delete pdfInfo.htmlForXfa;
[16791] Fix | Delete
loadingTask._capability.resolve(new PDFDocumentProxy(pdfInfo, this));
[16792] Fix | Delete
});
[16793] Fix | Delete
messageHandler.on("DocException", function (ex) {
[16794] Fix | Delete
let reason;
[16795] Fix | Delete
switch (ex.name) {
[16796] Fix | Delete
case "PasswordException":
[16797] Fix | Delete
reason = new PasswordException(ex.message, ex.code);
[16798] Fix | Delete
break;
[16799] Fix | Delete
case "InvalidPDFException":
[16800] Fix | Delete
reason = new InvalidPDFException(ex.message);
[16801] Fix | Delete
break;
[16802] Fix | Delete
case "MissingPDFException":
[16803] Fix | Delete
reason = new MissingPDFException(ex.message);
[16804] Fix | Delete
break;
[16805] Fix | Delete
case "UnexpectedResponseException":
[16806] Fix | Delete
reason = new UnexpectedResponseException(ex.message, ex.status);
[16807] Fix | Delete
break;
[16808] Fix | Delete
case "UnknownErrorException":
[16809] Fix | Delete
reason = new UnknownErrorException(ex.message, ex.details);
[16810] Fix | Delete
break;
[16811] Fix | Delete
default:
[16812] Fix | Delete
unreachable("DocException - expected a valid Error.");
[16813] Fix | Delete
}
[16814] Fix | Delete
loadingTask._capability.reject(reason);
[16815] Fix | Delete
});
[16816] Fix | Delete
messageHandler.on("PasswordRequest", exception => {
[16817] Fix | Delete
this.#passwordCapability = Promise.withResolvers();
[16818] Fix | Delete
if (loadingTask.onPassword) {
[16819] Fix | Delete
const updatePassword = password => {
[16820] Fix | Delete
if (password instanceof Error) {
[16821] Fix | Delete
this.#passwordCapability.reject(password);
[16822] Fix | Delete
} else {
[16823] Fix | Delete
this.#passwordCapability.resolve({
[16824] Fix | Delete
password
[16825] Fix | Delete
});
[16826] Fix | Delete
}
[16827] Fix | Delete
};
[16828] Fix | Delete
try {
[16829] Fix | Delete
loadingTask.onPassword(updatePassword, exception.code);
[16830] Fix | Delete
} catch (ex) {
[16831] Fix | Delete
this.#passwordCapability.reject(ex);
[16832] Fix | Delete
}
[16833] Fix | Delete
} else {
[16834] Fix | Delete
this.#passwordCapability.reject(new PasswordException(exception.message, exception.code));
[16835] Fix | Delete
}
[16836] Fix | Delete
return this.#passwordCapability.promise;
[16837] Fix | Delete
});
[16838] Fix | Delete
messageHandler.on("DataLoaded", data => {
[16839] Fix | Delete
loadingTask.onProgress?.({
[16840] Fix | Delete
loaded: data.length,
[16841] Fix | Delete
total: data.length
[16842] Fix | Delete
});
[16843] Fix | Delete
this.downloadInfoCapability.resolve(data);
[16844] Fix | Delete
});
[16845] Fix | Delete
messageHandler.on("StartRenderPage", data => {
[16846] Fix | Delete
if (this.destroyed) {
[16847] Fix | Delete
return;
[16848] Fix | Delete
}
[16849] Fix | Delete
const page = this.#pageCache.get(data.pageIndex);
[16850] Fix | Delete
page._startRenderPage(data.transparency, data.cacheKey);
[16851] Fix | Delete
});
[16852] Fix | Delete
messageHandler.on("commonobj", ([id, type, exportedData]) => {
[16853] Fix | Delete
if (this.destroyed) {
[16854] Fix | Delete
return null;
[16855] Fix | Delete
}
[16856] Fix | Delete
if (this.commonObjs.has(id)) {
[16857] Fix | Delete
return null;
[16858] Fix | Delete
}
[16859] Fix | Delete
switch (type) {
[16860] Fix | Delete
case "Font":
[16861] Fix | Delete
const {
[16862] Fix | Delete
disableFontFace,
[16863] Fix | Delete
fontExtraProperties,
[16864] Fix | Delete
pdfBug
[16865] Fix | Delete
} = this._params;
[16866] Fix | Delete
if ("error" in exportedData) {
[16867] Fix | Delete
const exportedError = exportedData.error;
[16868] Fix | Delete
warn(`Error during font loading: ${exportedError}`);
[16869] Fix | Delete
this.commonObjs.resolve(id, exportedError);
[16870] Fix | Delete
break;
[16871] Fix | Delete
}
[16872] Fix | Delete
const inspectFont = pdfBug && globalThis.FontInspector?.enabled ? (font, url) => globalThis.FontInspector.fontAdded(font, url) : null;
[16873] Fix | Delete
const font = new FontFaceObject(exportedData, {
[16874] Fix | Delete
disableFontFace,
[16875] Fix | Delete
inspectFont
[16876] Fix | Delete
});
[16877] Fix | Delete
this.fontLoader.bind(font).catch(() => messageHandler.sendWithPromise("FontFallback", {
[16878] Fix | Delete
id
[16879] Fix | Delete
})).finally(() => {
[16880] Fix | Delete
if (!fontExtraProperties && font.data) {
[16881] Fix | Delete
font.data = null;
[16882] Fix | Delete
}
[16883] Fix | Delete
this.commonObjs.resolve(id, font);
[16884] Fix | Delete
});
[16885] Fix | Delete
break;
[16886] Fix | Delete
case "CopyLocalImage":
[16887] Fix | Delete
const {
[16888] Fix | Delete
imageRef
[16889] Fix | Delete
} = exportedData;
[16890] Fix | Delete
assert(imageRef, "The imageRef must be defined.");
[16891] Fix | Delete
for (const pageProxy of this.#pageCache.values()) {
[16892] Fix | Delete
for (const [, data] of pageProxy.objs) {
[16893] Fix | Delete
if (data?.ref !== imageRef) {
[16894] Fix | Delete
continue;
[16895] Fix | Delete
}
[16896] Fix | Delete
if (!data.dataLen) {
[16897] Fix | Delete
return null;
[16898] Fix | Delete
}
[16899] Fix | Delete
this.commonObjs.resolve(id, structuredClone(data));
[16900] Fix | Delete
return data.dataLen;
[16901] Fix | Delete
}
[16902] Fix | Delete
}
[16903] Fix | Delete
break;
[16904] Fix | Delete
case "FontPath":
[16905] Fix | Delete
case "Image":
[16906] Fix | Delete
case "Pattern":
[16907] Fix | Delete
this.commonObjs.resolve(id, exportedData);
[16908] Fix | Delete
break;
[16909] Fix | Delete
default:
[16910] Fix | Delete
throw new Error(`Got unknown common object type ${type}`);
[16911] Fix | Delete
}
[16912] Fix | Delete
return null;
[16913] Fix | Delete
});
[16914] Fix | Delete
messageHandler.on("obj", ([id, pageIndex, type, imageData]) => {
[16915] Fix | Delete
if (this.destroyed) {
[16916] Fix | Delete
return;
[16917] Fix | Delete
}
[16918] Fix | Delete
const pageProxy = this.#pageCache.get(pageIndex);
[16919] Fix | Delete
if (pageProxy.objs.has(id)) {
[16920] Fix | Delete
return;
[16921] Fix | Delete
}
[16922] Fix | Delete
if (pageProxy._intentStates.size === 0) {
[16923] Fix | Delete
imageData?.bitmap?.close();
[16924] Fix | Delete
return;
[16925] Fix | Delete
}
[16926] Fix | Delete
switch (type) {
[16927] Fix | Delete
case "Image":
[16928] Fix | Delete
pageProxy.objs.resolve(id, imageData);
[16929] Fix | Delete
if (imageData?.dataLen > MAX_IMAGE_SIZE_TO_CACHE) {
[16930] Fix | Delete
pageProxy._maybeCleanupAfterRender = true;
[16931] Fix | Delete
}
[16932] Fix | Delete
break;
[16933] Fix | Delete
case "Pattern":
[16934] Fix | Delete
pageProxy.objs.resolve(id, imageData);
[16935] Fix | Delete
break;
[16936] Fix | Delete
default:
[16937] Fix | Delete
throw new Error(`Got unknown object type ${type}`);
[16938] Fix | Delete
}
[16939] Fix | Delete
});
[16940] Fix | Delete
messageHandler.on("DocProgress", data => {
[16941] Fix | Delete
if (this.destroyed) {
[16942] Fix | Delete
return;
[16943] Fix | Delete
}
[16944] Fix | Delete
loadingTask.onProgress?.({
[16945] Fix | Delete
loaded: data.loaded,
[16946] Fix | Delete
total: data.total
[16947] Fix | Delete
});
[16948] Fix | Delete
});
[16949] Fix | Delete
messageHandler.on("FetchBuiltInCMap", data => {
[16950] Fix | Delete
if (this.destroyed) {
[16951] Fix | Delete
return Promise.reject(new Error("Worker was destroyed."));
[16952] Fix | Delete
}
[16953] Fix | Delete
if (!this.cMapReaderFactory) {
[16954] Fix | Delete
return Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."));
[16955] Fix | Delete
}
[16956] Fix | Delete
return this.cMapReaderFactory.fetch(data);
[16957] Fix | Delete
});
[16958] Fix | Delete
messageHandler.on("FetchStandardFontData", data => {
[16959] Fix | Delete
if (this.destroyed) {
[16960] Fix | Delete
return Promise.reject(new Error("Worker was destroyed."));
[16961] Fix | Delete
}
[16962] Fix | Delete
if (!this.standardFontDataFactory) {
[16963] Fix | Delete
return Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter."));
[16964] Fix | Delete
}
[16965] Fix | Delete
return this.standardFontDataFactory.fetch(data);
[16966] Fix | Delete
});
[16967] Fix | Delete
}
[16968] Fix | Delete
getData() {
[16969] Fix | Delete
return this.messageHandler.sendWithPromise("GetData", null);
[16970] Fix | Delete
}
[16971] Fix | Delete
saveDocument() {
[16972] Fix | Delete
if (this.annotationStorage.size <= 0) {
[16973] Fix | Delete
warn("saveDocument called while `annotationStorage` is empty, " + "please use the getData-method instead.");
[16974] Fix | Delete
}
[16975] Fix | Delete
const {
[16976] Fix | Delete
map,
[16977] Fix | Delete
transfer
[16978] Fix | Delete
} = this.annotationStorage.serializable;
[16979] Fix | Delete
return this.messageHandler.sendWithPromise("SaveDocument", {
[16980] Fix | Delete
isPureXfa: !!this._htmlForXfa,
[16981] Fix | Delete
numPages: this._numPages,
[16982] Fix | Delete
annotationStorage: map,
[16983] Fix | Delete
filename: this._fullReader?.filename ?? null
[16984] Fix | Delete
}, transfer).finally(() => {
[16985] Fix | Delete
this.annotationStorage.resetModified();
[16986] Fix | Delete
});
[16987] Fix | Delete
}
[16988] Fix | Delete
getPage(pageNumber) {
[16989] Fix | Delete
if (!Number.isInteger(pageNumber) || pageNumber <= 0 || pageNumber > this._numPages) {
[16990] Fix | Delete
return Promise.reject(new Error("Invalid page request."));
[16991] Fix | Delete
}
[16992] Fix | Delete
const pageIndex = pageNumber - 1,
[16993] Fix | Delete
cachedPromise = this.#pagePromises.get(pageIndex);
[16994] Fix | Delete
if (cachedPromise) {
[16995] Fix | Delete
return cachedPromise;
[16996] Fix | Delete
}
[16997] Fix | Delete
const promise = this.messageHandler.sendWithPromise("GetPage", {
[16998] Fix | Delete
pageIndex
[16999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function