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: pdf.worker.js
this._reader = readableStream.getReader();
[60500] Fix | Delete
}
[60501] Fix | Delete
get isStreamingSupported() {
[60502] Fix | Delete
return false;
[60503] Fix | Delete
}
[60504] Fix | Delete
async read() {
[60505] Fix | Delete
const {
[60506] Fix | Delete
value,
[60507] Fix | Delete
done
[60508] Fix | Delete
} = await this._reader.read();
[60509] Fix | Delete
if (done) {
[60510] Fix | Delete
return {
[60511] Fix | Delete
value: undefined,
[60512] Fix | Delete
done: true
[60513] Fix | Delete
};
[60514] Fix | Delete
}
[60515] Fix | Delete
return {
[60516] Fix | Delete
value: value.buffer,
[60517] Fix | Delete
done: false
[60518] Fix | Delete
};
[60519] Fix | Delete
}
[60520] Fix | Delete
cancel(reason) {
[60521] Fix | Delete
this._reader.cancel(reason);
[60522] Fix | Delete
}
[60523] Fix | Delete
}
[60524] Fix | Delete
[60525] Fix | Delete
;// CONCATENATED MODULE: ./src/core/worker.js
[60526] Fix | Delete
[60527] Fix | Delete
[60528] Fix | Delete
[60529] Fix | Delete
[60530] Fix | Delete
[60531] Fix | Delete
[60532] Fix | Delete
[60533] Fix | Delete
[60534] Fix | Delete
[60535] Fix | Delete
[60536] Fix | Delete
[60537] Fix | Delete
[60538] Fix | Delete
[60539] Fix | Delete
[60540] Fix | Delete
[60541] Fix | Delete
[60542] Fix | Delete
[60543] Fix | Delete
[60544] Fix | Delete
[60545] Fix | Delete
[60546] Fix | Delete
[60547] Fix | Delete
[60548] Fix | Delete
[60549] Fix | Delete
[60550] Fix | Delete
[60551] Fix | Delete
[60552] Fix | Delete
[60553] Fix | Delete
[60554] Fix | Delete
[60555] Fix | Delete
[60556] Fix | Delete
class WorkerTask {
[60557] Fix | Delete
constructor(name) {
[60558] Fix | Delete
this.name = name;
[60559] Fix | Delete
this.terminated = false;
[60560] Fix | Delete
this._capability = Promise.withResolvers();
[60561] Fix | Delete
}
[60562] Fix | Delete
get finished() {
[60563] Fix | Delete
return this._capability.promise;
[60564] Fix | Delete
}
[60565] Fix | Delete
finish() {
[60566] Fix | Delete
this._capability.resolve();
[60567] Fix | Delete
}
[60568] Fix | Delete
terminate() {
[60569] Fix | Delete
this.terminated = true;
[60570] Fix | Delete
}
[60571] Fix | Delete
ensureNotTerminated() {
[60572] Fix | Delete
if (this.terminated) {
[60573] Fix | Delete
throw new Error("Worker task was terminated");
[60574] Fix | Delete
}
[60575] Fix | Delete
}
[60576] Fix | Delete
}
[60577] Fix | Delete
class WorkerMessageHandler {
[60578] Fix | Delete
static setup(handler, port) {
[60579] Fix | Delete
let testMessageProcessed = false;
[60580] Fix | Delete
handler.on("test", function (data) {
[60581] Fix | Delete
if (testMessageProcessed) {
[60582] Fix | Delete
return;
[60583] Fix | Delete
}
[60584] Fix | Delete
testMessageProcessed = true;
[60585] Fix | Delete
handler.send("test", data instanceof Uint8Array);
[60586] Fix | Delete
});
[60587] Fix | Delete
handler.on("configure", function (data) {
[60588] Fix | Delete
setVerbosityLevel(data.verbosity);
[60589] Fix | Delete
});
[60590] Fix | Delete
handler.on("GetDocRequest", function (data) {
[60591] Fix | Delete
return WorkerMessageHandler.createDocumentHandler(data, port);
[60592] Fix | Delete
});
[60593] Fix | Delete
}
[60594] Fix | Delete
static createDocumentHandler(docParams, port) {
[60595] Fix | Delete
let pdfManager;
[60596] Fix | Delete
let terminated = false;
[60597] Fix | Delete
let cancelXHRs = null;
[60598] Fix | Delete
const WorkerTasks = new Set();
[60599] Fix | Delete
const verbosity = getVerbosityLevel();
[60600] Fix | Delete
const {
[60601] Fix | Delete
docId,
[60602] Fix | Delete
apiVersion
[60603] Fix | Delete
} = docParams;
[60604] Fix | Delete
const workerVersion = "4.3.136";
[60605] Fix | Delete
if (apiVersion !== workerVersion) {
[60606] Fix | Delete
throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
[60607] Fix | Delete
}
[60608] Fix | Delete
const enumerableProperties = [];
[60609] Fix | Delete
for (const property in []) {
[60610] Fix | Delete
enumerableProperties.push(property);
[60611] Fix | Delete
}
[60612] Fix | Delete
if (enumerableProperties.length) {
[60613] Fix | Delete
throw new Error("The `Array.prototype` contains unexpected enumerable properties: " + enumerableProperties.join(", ") + "; thus breaking e.g. `for...in` iteration of `Array`s.");
[60614] Fix | Delete
}
[60615] Fix | Delete
const workerHandlerName = docId + "_worker";
[60616] Fix | Delete
let handler = new MessageHandler(workerHandlerName, docId, port);
[60617] Fix | Delete
function ensureNotTerminated() {
[60618] Fix | Delete
if (terminated) {
[60619] Fix | Delete
throw new Error("Worker was terminated");
[60620] Fix | Delete
}
[60621] Fix | Delete
}
[60622] Fix | Delete
function startWorkerTask(task) {
[60623] Fix | Delete
WorkerTasks.add(task);
[60624] Fix | Delete
}
[60625] Fix | Delete
function finishWorkerTask(task) {
[60626] Fix | Delete
task.finish();
[60627] Fix | Delete
WorkerTasks.delete(task);
[60628] Fix | Delete
}
[60629] Fix | Delete
async function loadDocument(recoveryMode) {
[60630] Fix | Delete
await pdfManager.ensureDoc("checkHeader");
[60631] Fix | Delete
await pdfManager.ensureDoc("parseStartXRef");
[60632] Fix | Delete
await pdfManager.ensureDoc("parse", [recoveryMode]);
[60633] Fix | Delete
await pdfManager.ensureDoc("checkFirstPage", [recoveryMode]);
[60634] Fix | Delete
await pdfManager.ensureDoc("checkLastPage", [recoveryMode]);
[60635] Fix | Delete
const isPureXfa = await pdfManager.ensureDoc("isPureXfa");
[60636] Fix | Delete
if (isPureXfa) {
[60637] Fix | Delete
const task = new WorkerTask("loadXfaFonts");
[60638] Fix | Delete
startWorkerTask(task);
[60639] Fix | Delete
await Promise.all([pdfManager.loadXfaFonts(handler, task).catch(reason => {}).then(() => finishWorkerTask(task)), pdfManager.loadXfaImages()]);
[60640] Fix | Delete
}
[60641] Fix | Delete
const [numPages, fingerprints] = await Promise.all([pdfManager.ensureDoc("numPages"), pdfManager.ensureDoc("fingerprints")]);
[60642] Fix | Delete
const htmlForXfa = isPureXfa ? await pdfManager.ensureDoc("htmlForXfa") : null;
[60643] Fix | Delete
return {
[60644] Fix | Delete
numPages,
[60645] Fix | Delete
fingerprints,
[60646] Fix | Delete
htmlForXfa
[60647] Fix | Delete
};
[60648] Fix | Delete
}
[60649] Fix | Delete
function getPdfManager({
[60650] Fix | Delete
data,
[60651] Fix | Delete
password,
[60652] Fix | Delete
disableAutoFetch,
[60653] Fix | Delete
rangeChunkSize,
[60654] Fix | Delete
length,
[60655] Fix | Delete
docBaseUrl,
[60656] Fix | Delete
enableXfa,
[60657] Fix | Delete
evaluatorOptions
[60658] Fix | Delete
}) {
[60659] Fix | Delete
const pdfManagerArgs = {
[60660] Fix | Delete
source: null,
[60661] Fix | Delete
disableAutoFetch,
[60662] Fix | Delete
docBaseUrl,
[60663] Fix | Delete
docId,
[60664] Fix | Delete
enableXfa,
[60665] Fix | Delete
evaluatorOptions,
[60666] Fix | Delete
handler,
[60667] Fix | Delete
length,
[60668] Fix | Delete
password,
[60669] Fix | Delete
rangeChunkSize
[60670] Fix | Delete
};
[60671] Fix | Delete
const pdfManagerCapability = Promise.withResolvers();
[60672] Fix | Delete
let newPdfManager;
[60673] Fix | Delete
if (data) {
[60674] Fix | Delete
try {
[60675] Fix | Delete
pdfManagerArgs.source = data;
[60676] Fix | Delete
newPdfManager = new LocalPdfManager(pdfManagerArgs);
[60677] Fix | Delete
pdfManagerCapability.resolve(newPdfManager);
[60678] Fix | Delete
} catch (ex) {
[60679] Fix | Delete
pdfManagerCapability.reject(ex);
[60680] Fix | Delete
}
[60681] Fix | Delete
return pdfManagerCapability.promise;
[60682] Fix | Delete
}
[60683] Fix | Delete
let pdfStream,
[60684] Fix | Delete
cachedChunks = [];
[60685] Fix | Delete
try {
[60686] Fix | Delete
pdfStream = new PDFWorkerStream(handler);
[60687] Fix | Delete
} catch (ex) {
[60688] Fix | Delete
pdfManagerCapability.reject(ex);
[60689] Fix | Delete
return pdfManagerCapability.promise;
[60690] Fix | Delete
}
[60691] Fix | Delete
const fullRequest = pdfStream.getFullReader();
[60692] Fix | Delete
fullRequest.headersReady.then(function () {
[60693] Fix | Delete
if (!fullRequest.isRangeSupported) {
[60694] Fix | Delete
return;
[60695] Fix | Delete
}
[60696] Fix | Delete
pdfManagerArgs.source = pdfStream;
[60697] Fix | Delete
pdfManagerArgs.length = fullRequest.contentLength;
[60698] Fix | Delete
pdfManagerArgs.disableAutoFetch ||= fullRequest.isStreamingSupported;
[60699] Fix | Delete
newPdfManager = new NetworkPdfManager(pdfManagerArgs);
[60700] Fix | Delete
for (const chunk of cachedChunks) {
[60701] Fix | Delete
newPdfManager.sendProgressiveData(chunk);
[60702] Fix | Delete
}
[60703] Fix | Delete
cachedChunks = [];
[60704] Fix | Delete
pdfManagerCapability.resolve(newPdfManager);
[60705] Fix | Delete
cancelXHRs = null;
[60706] Fix | Delete
}).catch(function (reason) {
[60707] Fix | Delete
pdfManagerCapability.reject(reason);
[60708] Fix | Delete
cancelXHRs = null;
[60709] Fix | Delete
});
[60710] Fix | Delete
let loaded = 0;
[60711] Fix | Delete
const flushChunks = function () {
[60712] Fix | Delete
const pdfFile = arrayBuffersToBytes(cachedChunks);
[60713] Fix | Delete
if (length && pdfFile.length !== length) {
[60714] Fix | Delete
warn("reported HTTP length is different from actual");
[60715] Fix | Delete
}
[60716] Fix | Delete
try {
[60717] Fix | Delete
pdfManagerArgs.source = pdfFile;
[60718] Fix | Delete
newPdfManager = new LocalPdfManager(pdfManagerArgs);
[60719] Fix | Delete
pdfManagerCapability.resolve(newPdfManager);
[60720] Fix | Delete
} catch (ex) {
[60721] Fix | Delete
pdfManagerCapability.reject(ex);
[60722] Fix | Delete
}
[60723] Fix | Delete
cachedChunks = [];
[60724] Fix | Delete
};
[60725] Fix | Delete
new Promise(function (resolve, reject) {
[60726] Fix | Delete
const readChunk = function ({
[60727] Fix | Delete
value,
[60728] Fix | Delete
done
[60729] Fix | Delete
}) {
[60730] Fix | Delete
try {
[60731] Fix | Delete
ensureNotTerminated();
[60732] Fix | Delete
if (done) {
[60733] Fix | Delete
if (!newPdfManager) {
[60734] Fix | Delete
flushChunks();
[60735] Fix | Delete
}
[60736] Fix | Delete
cancelXHRs = null;
[60737] Fix | Delete
return;
[60738] Fix | Delete
}
[60739] Fix | Delete
loaded += value.byteLength;
[60740] Fix | Delete
if (!fullRequest.isStreamingSupported) {
[60741] Fix | Delete
handler.send("DocProgress", {
[60742] Fix | Delete
loaded,
[60743] Fix | Delete
total: Math.max(loaded, fullRequest.contentLength || 0)
[60744] Fix | Delete
});
[60745] Fix | Delete
}
[60746] Fix | Delete
if (newPdfManager) {
[60747] Fix | Delete
newPdfManager.sendProgressiveData(value);
[60748] Fix | Delete
} else {
[60749] Fix | Delete
cachedChunks.push(value);
[60750] Fix | Delete
}
[60751] Fix | Delete
fullRequest.read().then(readChunk, reject);
[60752] Fix | Delete
} catch (e) {
[60753] Fix | Delete
reject(e);
[60754] Fix | Delete
}
[60755] Fix | Delete
};
[60756] Fix | Delete
fullRequest.read().then(readChunk, reject);
[60757] Fix | Delete
}).catch(function (e) {
[60758] Fix | Delete
pdfManagerCapability.reject(e);
[60759] Fix | Delete
cancelXHRs = null;
[60760] Fix | Delete
});
[60761] Fix | Delete
cancelXHRs = function (reason) {
[60762] Fix | Delete
pdfStream.cancelAllRequests(reason);
[60763] Fix | Delete
};
[60764] Fix | Delete
return pdfManagerCapability.promise;
[60765] Fix | Delete
}
[60766] Fix | Delete
function setupDoc(data) {
[60767] Fix | Delete
function onSuccess(doc) {
[60768] Fix | Delete
ensureNotTerminated();
[60769] Fix | Delete
handler.send("GetDoc", {
[60770] Fix | Delete
pdfInfo: doc
[60771] Fix | Delete
});
[60772] Fix | Delete
}
[60773] Fix | Delete
function onFailure(ex) {
[60774] Fix | Delete
ensureNotTerminated();
[60775] Fix | Delete
if (ex instanceof PasswordException) {
[60776] Fix | Delete
const task = new WorkerTask(`PasswordException: response ${ex.code}`);
[60777] Fix | Delete
startWorkerTask(task);
[60778] Fix | Delete
handler.sendWithPromise("PasswordRequest", ex).then(function ({
[60779] Fix | Delete
password
[60780] Fix | Delete
}) {
[60781] Fix | Delete
finishWorkerTask(task);
[60782] Fix | Delete
pdfManager.updatePassword(password);
[60783] Fix | Delete
pdfManagerReady();
[60784] Fix | Delete
}).catch(function () {
[60785] Fix | Delete
finishWorkerTask(task);
[60786] Fix | Delete
handler.send("DocException", ex);
[60787] Fix | Delete
});
[60788] Fix | Delete
} else if (ex instanceof InvalidPDFException || ex instanceof MissingPDFException || ex instanceof UnexpectedResponseException || ex instanceof UnknownErrorException) {
[60789] Fix | Delete
handler.send("DocException", ex);
[60790] Fix | Delete
} else {
[60791] Fix | Delete
handler.send("DocException", new UnknownErrorException(ex.message, ex.toString()));
[60792] Fix | Delete
}
[60793] Fix | Delete
}
[60794] Fix | Delete
function pdfManagerReady() {
[60795] Fix | Delete
ensureNotTerminated();
[60796] Fix | Delete
loadDocument(false).then(onSuccess, function (reason) {
[60797] Fix | Delete
ensureNotTerminated();
[60798] Fix | Delete
if (!(reason instanceof XRefParseException)) {
[60799] Fix | Delete
onFailure(reason);
[60800] Fix | Delete
return;
[60801] Fix | Delete
}
[60802] Fix | Delete
pdfManager.requestLoadedStream().then(function () {
[60803] Fix | Delete
ensureNotTerminated();
[60804] Fix | Delete
loadDocument(true).then(onSuccess, onFailure);
[60805] Fix | Delete
});
[60806] Fix | Delete
});
[60807] Fix | Delete
}
[60808] Fix | Delete
ensureNotTerminated();
[60809] Fix | Delete
getPdfManager(data).then(function (newPdfManager) {
[60810] Fix | Delete
if (terminated) {
[60811] Fix | Delete
newPdfManager.terminate(new AbortException("Worker was terminated."));
[60812] Fix | Delete
throw new Error("Worker was terminated");
[60813] Fix | Delete
}
[60814] Fix | Delete
pdfManager = newPdfManager;
[60815] Fix | Delete
pdfManager.requestLoadedStream(true).then(stream => {
[60816] Fix | Delete
handler.send("DataLoaded", {
[60817] Fix | Delete
length: stream.bytes.byteLength
[60818] Fix | Delete
});
[60819] Fix | Delete
});
[60820] Fix | Delete
}).then(pdfManagerReady, onFailure);
[60821] Fix | Delete
}
[60822] Fix | Delete
handler.on("GetPage", function (data) {
[60823] Fix | Delete
return pdfManager.getPage(data.pageIndex).then(function (page) {
[60824] Fix | Delete
return Promise.all([pdfManager.ensure(page, "rotate"), pdfManager.ensure(page, "ref"), pdfManager.ensure(page, "userUnit"), pdfManager.ensure(page, "view")]).then(function ([rotate, ref, userUnit, view]) {
[60825] Fix | Delete
return {
[60826] Fix | Delete
rotate,
[60827] Fix | Delete
ref,
[60828] Fix | Delete
refStr: ref?.toString() ?? null,
[60829] Fix | Delete
userUnit,
[60830] Fix | Delete
view
[60831] Fix | Delete
};
[60832] Fix | Delete
});
[60833] Fix | Delete
});
[60834] Fix | Delete
});
[60835] Fix | Delete
handler.on("GetPageIndex", function (data) {
[60836] Fix | Delete
const pageRef = Ref.get(data.num, data.gen);
[60837] Fix | Delete
return pdfManager.ensureCatalog("getPageIndex", [pageRef]);
[60838] Fix | Delete
});
[60839] Fix | Delete
handler.on("GetDestinations", function (data) {
[60840] Fix | Delete
return pdfManager.ensureCatalog("destinations");
[60841] Fix | Delete
});
[60842] Fix | Delete
handler.on("GetDestination", function (data) {
[60843] Fix | Delete
return pdfManager.ensureCatalog("getDestination", [data.id]);
[60844] Fix | Delete
});
[60845] Fix | Delete
handler.on("GetPageLabels", function (data) {
[60846] Fix | Delete
return pdfManager.ensureCatalog("pageLabels");
[60847] Fix | Delete
});
[60848] Fix | Delete
handler.on("GetPageLayout", function (data) {
[60849] Fix | Delete
return pdfManager.ensureCatalog("pageLayout");
[60850] Fix | Delete
});
[60851] Fix | Delete
handler.on("GetPageMode", function (data) {
[60852] Fix | Delete
return pdfManager.ensureCatalog("pageMode");
[60853] Fix | Delete
});
[60854] Fix | Delete
handler.on("GetViewerPreferences", function (data) {
[60855] Fix | Delete
return pdfManager.ensureCatalog("viewerPreferences");
[60856] Fix | Delete
});
[60857] Fix | Delete
handler.on("GetOpenAction", function (data) {
[60858] Fix | Delete
return pdfManager.ensureCatalog("openAction");
[60859] Fix | Delete
});
[60860] Fix | Delete
handler.on("GetAttachments", function (data) {
[60861] Fix | Delete
return pdfManager.ensureCatalog("attachments");
[60862] Fix | Delete
});
[60863] Fix | Delete
handler.on("GetDocJSActions", function (data) {
[60864] Fix | Delete
return pdfManager.ensureCatalog("jsActions");
[60865] Fix | Delete
});
[60866] Fix | Delete
handler.on("GetPageJSActions", function ({
[60867] Fix | Delete
pageIndex
[60868] Fix | Delete
}) {
[60869] Fix | Delete
return pdfManager.getPage(pageIndex).then(function (page) {
[60870] Fix | Delete
return pdfManager.ensure(page, "jsActions");
[60871] Fix | Delete
});
[60872] Fix | Delete
});
[60873] Fix | Delete
handler.on("GetOutline", function (data) {
[60874] Fix | Delete
return pdfManager.ensureCatalog("documentOutline");
[60875] Fix | Delete
});
[60876] Fix | Delete
handler.on("GetOptionalContentConfig", function (data) {
[60877] Fix | Delete
return pdfManager.ensureCatalog("optionalContentConfig");
[60878] Fix | Delete
});
[60879] Fix | Delete
handler.on("GetPermissions", function (data) {
[60880] Fix | Delete
return pdfManager.ensureCatalog("permissions");
[60881] Fix | Delete
});
[60882] Fix | Delete
handler.on("GetMetadata", function (data) {
[60883] Fix | Delete
return Promise.all([pdfManager.ensureDoc("documentInfo"), pdfManager.ensureCatalog("metadata")]);
[60884] Fix | Delete
});
[60885] Fix | Delete
handler.on("GetMarkInfo", function (data) {
[60886] Fix | Delete
return pdfManager.ensureCatalog("markInfo");
[60887] Fix | Delete
});
[60888] Fix | Delete
handler.on("GetData", function (data) {
[60889] Fix | Delete
return pdfManager.requestLoadedStream().then(function (stream) {
[60890] Fix | Delete
return stream.bytes;
[60891] Fix | Delete
});
[60892] Fix | Delete
});
[60893] Fix | Delete
handler.on("GetAnnotations", function ({
[60894] Fix | Delete
pageIndex,
[60895] Fix | Delete
intent
[60896] Fix | Delete
}) {
[60897] Fix | Delete
return pdfManager.getPage(pageIndex).then(function (page) {
[60898] Fix | Delete
const task = new WorkerTask(`GetAnnotations: page ${pageIndex}`);
[60899] Fix | Delete
startWorkerTask(task);
[60900] Fix | Delete
return page.getAnnotationsData(handler, task, intent).then(data => {
[60901] Fix | Delete
finishWorkerTask(task);
[60902] Fix | Delete
return data;
[60903] Fix | Delete
}, reason => {
[60904] Fix | Delete
finishWorkerTask(task);
[60905] Fix | Delete
throw reason;
[60906] Fix | Delete
});
[60907] Fix | Delete
});
[60908] Fix | Delete
});
[60909] Fix | Delete
handler.on("GetFieldObjects", function (data) {
[60910] Fix | Delete
return pdfManager.ensureDoc("fieldObjects");
[60911] Fix | Delete
});
[60912] Fix | Delete
handler.on("HasJSActions", function (data) {
[60913] Fix | Delete
return pdfManager.ensureDoc("hasJSActions");
[60914] Fix | Delete
});
[60915] Fix | Delete
handler.on("GetCalculationOrderIds", function (data) {
[60916] Fix | Delete
return pdfManager.ensureDoc("calculationOrderIds");
[60917] Fix | Delete
});
[60918] Fix | Delete
handler.on("SaveDocument", async function ({
[60919] Fix | Delete
isPureXfa,
[60920] Fix | Delete
numPages,
[60921] Fix | Delete
annotationStorage,
[60922] Fix | Delete
filename
[60923] Fix | Delete
}) {
[60924] Fix | Delete
const globalPromises = [pdfManager.requestLoadedStream(), pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("acroFormRef"), pdfManager.ensureDoc("startXRef"), pdfManager.ensureDoc("xref"), pdfManager.ensureDoc("linearization"), pdfManager.ensureCatalog("structTreeRoot")];
[60925] Fix | Delete
const promises = [];
[60926] Fix | Delete
const newAnnotationsByPage = !isPureXfa ? getNewAnnotationsMap(annotationStorage) : null;
[60927] Fix | Delete
const [stream, acroForm, acroFormRef, startXRef, xref, linearization, _structTreeRoot] = await Promise.all(globalPromises);
[60928] Fix | Delete
const catalogRef = xref.trailer.getRaw("Root") || null;
[60929] Fix | Delete
let structTreeRoot;
[60930] Fix | Delete
if (newAnnotationsByPage) {
[60931] Fix | Delete
if (!_structTreeRoot) {
[60932] Fix | Delete
if (await StructTreeRoot.canCreateStructureTree({
[60933] Fix | Delete
catalogRef,
[60934] Fix | Delete
pdfManager,
[60935] Fix | Delete
newAnnotationsByPage
[60936] Fix | Delete
})) {
[60937] Fix | Delete
structTreeRoot = null;
[60938] Fix | Delete
}
[60939] Fix | Delete
} else if (await _structTreeRoot.canUpdateStructTree({
[60940] Fix | Delete
pdfManager,
[60941] Fix | Delete
xref,
[60942] Fix | Delete
newAnnotationsByPage
[60943] Fix | Delete
})) {
[60944] Fix | Delete
structTreeRoot = _structTreeRoot;
[60945] Fix | Delete
}
[60946] Fix | Delete
const imagePromises = AnnotationFactory.generateImages(annotationStorage.values(), xref, pdfManager.evaluatorOptions.isOffscreenCanvasSupported);
[60947] Fix | Delete
const newAnnotationPromises = structTreeRoot === undefined ? promises : [];
[60948] Fix | Delete
for (const [pageIndex, annotations] of newAnnotationsByPage) {
[60949] Fix | Delete
newAnnotationPromises.push(pdfManager.getPage(pageIndex).then(page => {
[60950] Fix | Delete
const task = new WorkerTask(`Save (editor): page ${pageIndex}`);
[60951] Fix | Delete
return page.saveNewAnnotations(handler, task, annotations, imagePromises).finally(function () {
[60952] Fix | Delete
finishWorkerTask(task);
[60953] Fix | Delete
});
[60954] Fix | Delete
}));
[60955] Fix | Delete
}
[60956] Fix | Delete
if (structTreeRoot === null) {
[60957] Fix | Delete
promises.push(Promise.all(newAnnotationPromises).then(async newRefs => {
[60958] Fix | Delete
await StructTreeRoot.createStructureTree({
[60959] Fix | Delete
newAnnotationsByPage,
[60960] Fix | Delete
xref,
[60961] Fix | Delete
catalogRef,
[60962] Fix | Delete
pdfManager,
[60963] Fix | Delete
newRefs
[60964] Fix | Delete
});
[60965] Fix | Delete
return newRefs;
[60966] Fix | Delete
}));
[60967] Fix | Delete
} else if (structTreeRoot) {
[60968] Fix | Delete
promises.push(Promise.all(newAnnotationPromises).then(async newRefs => {
[60969] Fix | Delete
await structTreeRoot.updateStructureTree({
[60970] Fix | Delete
newAnnotationsByPage,
[60971] Fix | Delete
pdfManager,
[60972] Fix | Delete
newRefs
[60973] Fix | Delete
});
[60974] Fix | Delete
return newRefs;
[60975] Fix | Delete
}));
[60976] Fix | Delete
}
[60977] Fix | Delete
}
[60978] Fix | Delete
if (isPureXfa) {
[60979] Fix | Delete
promises.push(pdfManager.serializeXfaData(annotationStorage));
[60980] Fix | Delete
} else {
[60981] Fix | Delete
for (let pageIndex = 0; pageIndex < numPages; pageIndex++) {
[60982] Fix | Delete
promises.push(pdfManager.getPage(pageIndex).then(function (page) {
[60983] Fix | Delete
const task = new WorkerTask(`Save: page ${pageIndex}`);
[60984] Fix | Delete
return page.save(handler, task, annotationStorage).finally(function () {
[60985] Fix | Delete
finishWorkerTask(task);
[60986] Fix | Delete
});
[60987] Fix | Delete
}));
[60988] Fix | Delete
}
[60989] Fix | Delete
}
[60990] Fix | Delete
const refs = await Promise.all(promises);
[60991] Fix | Delete
let newRefs = [];
[60992] Fix | Delete
let xfaData = null;
[60993] Fix | Delete
if (isPureXfa) {
[60994] Fix | Delete
xfaData = refs[0];
[60995] Fix | Delete
if (!xfaData) {
[60996] Fix | Delete
return stream.bytes;
[60997] Fix | Delete
}
[60998] Fix | Delete
} else {
[60999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function