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
[58500] Fix | Delete
[58501] Fix | Delete
[58502] Fix | Delete
[58503] Fix | Delete
[58504] Fix | Delete
[58505] Fix | Delete
[58506] Fix | Delete
[58507] Fix | Delete
const DEFAULT_USER_UNIT = 1.0;
[58508] Fix | Delete
const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];
[58509] Fix | Delete
class Page {
[58510] Fix | Delete
constructor({
[58511] Fix | Delete
pdfManager,
[58512] Fix | Delete
xref,
[58513] Fix | Delete
pageIndex,
[58514] Fix | Delete
pageDict,
[58515] Fix | Delete
ref,
[58516] Fix | Delete
globalIdFactory,
[58517] Fix | Delete
fontCache,
[58518] Fix | Delete
builtInCMapCache,
[58519] Fix | Delete
standardFontDataCache,
[58520] Fix | Delete
globalImageCache,
[58521] Fix | Delete
systemFontCache,
[58522] Fix | Delete
nonBlendModesSet,
[58523] Fix | Delete
xfaFactory
[58524] Fix | Delete
}) {
[58525] Fix | Delete
this.pdfManager = pdfManager;
[58526] Fix | Delete
this.pageIndex = pageIndex;
[58527] Fix | Delete
this.pageDict = pageDict;
[58528] Fix | Delete
this.xref = xref;
[58529] Fix | Delete
this.ref = ref;
[58530] Fix | Delete
this.fontCache = fontCache;
[58531] Fix | Delete
this.builtInCMapCache = builtInCMapCache;
[58532] Fix | Delete
this.standardFontDataCache = standardFontDataCache;
[58533] Fix | Delete
this.globalImageCache = globalImageCache;
[58534] Fix | Delete
this.systemFontCache = systemFontCache;
[58535] Fix | Delete
this.nonBlendModesSet = nonBlendModesSet;
[58536] Fix | Delete
this.evaluatorOptions = pdfManager.evaluatorOptions;
[58537] Fix | Delete
this.resourcesPromise = null;
[58538] Fix | Delete
this.xfaFactory = xfaFactory;
[58539] Fix | Delete
const idCounters = {
[58540] Fix | Delete
obj: 0
[58541] Fix | Delete
};
[58542] Fix | Delete
this._localIdFactory = class extends globalIdFactory {
[58543] Fix | Delete
static createObjId() {
[58544] Fix | Delete
return `p${pageIndex}_${++idCounters.obj}`;
[58545] Fix | Delete
}
[58546] Fix | Delete
static getPageObjId() {
[58547] Fix | Delete
return `p${ref.toString()}`;
[58548] Fix | Delete
}
[58549] Fix | Delete
};
[58550] Fix | Delete
}
[58551] Fix | Delete
_getInheritableProperty(key, getArray = false) {
[58552] Fix | Delete
const value = getInheritableProperty({
[58553] Fix | Delete
dict: this.pageDict,
[58554] Fix | Delete
key,
[58555] Fix | Delete
getArray,
[58556] Fix | Delete
stopWhenFound: false
[58557] Fix | Delete
});
[58558] Fix | Delete
if (!Array.isArray(value)) {
[58559] Fix | Delete
return value;
[58560] Fix | Delete
}
[58561] Fix | Delete
if (value.length === 1 || !(value[0] instanceof Dict)) {
[58562] Fix | Delete
return value[0];
[58563] Fix | Delete
}
[58564] Fix | Delete
return Dict.merge({
[58565] Fix | Delete
xref: this.xref,
[58566] Fix | Delete
dictArray: value
[58567] Fix | Delete
});
[58568] Fix | Delete
}
[58569] Fix | Delete
get content() {
[58570] Fix | Delete
return this.pageDict.getArray("Contents");
[58571] Fix | Delete
}
[58572] Fix | Delete
get resources() {
[58573] Fix | Delete
const resources = this._getInheritableProperty("Resources");
[58574] Fix | Delete
return shadow(this, "resources", resources instanceof Dict ? resources : Dict.empty);
[58575] Fix | Delete
}
[58576] Fix | Delete
_getBoundingBox(name) {
[58577] Fix | Delete
if (this.xfaData) {
[58578] Fix | Delete
return this.xfaData.bbox;
[58579] Fix | Delete
}
[58580] Fix | Delete
const box = lookupNormalRect(this._getInheritableProperty(name, true), null);
[58581] Fix | Delete
if (box) {
[58582] Fix | Delete
if (box[2] - box[0] > 0 && box[3] - box[1] > 0) {
[58583] Fix | Delete
return box;
[58584] Fix | Delete
}
[58585] Fix | Delete
warn(`Empty, or invalid, /${name} entry.`);
[58586] Fix | Delete
}
[58587] Fix | Delete
return null;
[58588] Fix | Delete
}
[58589] Fix | Delete
get mediaBox() {
[58590] Fix | Delete
return shadow(this, "mediaBox", this._getBoundingBox("MediaBox") || LETTER_SIZE_MEDIABOX);
[58591] Fix | Delete
}
[58592] Fix | Delete
get cropBox() {
[58593] Fix | Delete
return shadow(this, "cropBox", this._getBoundingBox("CropBox") || this.mediaBox);
[58594] Fix | Delete
}
[58595] Fix | Delete
get userUnit() {
[58596] Fix | Delete
let obj = this.pageDict.get("UserUnit");
[58597] Fix | Delete
if (typeof obj !== "number" || obj <= 0) {
[58598] Fix | Delete
obj = DEFAULT_USER_UNIT;
[58599] Fix | Delete
}
[58600] Fix | Delete
return shadow(this, "userUnit", obj);
[58601] Fix | Delete
}
[58602] Fix | Delete
get view() {
[58603] Fix | Delete
const {
[58604] Fix | Delete
cropBox,
[58605] Fix | Delete
mediaBox
[58606] Fix | Delete
} = this;
[58607] Fix | Delete
if (cropBox !== mediaBox && !isArrayEqual(cropBox, mediaBox)) {
[58608] Fix | Delete
const box = Util.intersect(cropBox, mediaBox);
[58609] Fix | Delete
if (box && box[2] - box[0] > 0 && box[3] - box[1] > 0) {
[58610] Fix | Delete
return shadow(this, "view", box);
[58611] Fix | Delete
}
[58612] Fix | Delete
warn("Empty /CropBox and /MediaBox intersection.");
[58613] Fix | Delete
}
[58614] Fix | Delete
return shadow(this, "view", mediaBox);
[58615] Fix | Delete
}
[58616] Fix | Delete
get rotate() {
[58617] Fix | Delete
let rotate = this._getInheritableProperty("Rotate") || 0;
[58618] Fix | Delete
if (rotate % 90 !== 0) {
[58619] Fix | Delete
rotate = 0;
[58620] Fix | Delete
} else if (rotate >= 360) {
[58621] Fix | Delete
rotate %= 360;
[58622] Fix | Delete
} else if (rotate < 0) {
[58623] Fix | Delete
rotate = (rotate % 360 + 360) % 360;
[58624] Fix | Delete
}
[58625] Fix | Delete
return shadow(this, "rotate", rotate);
[58626] Fix | Delete
}
[58627] Fix | Delete
_onSubStreamError(reason, objId) {
[58628] Fix | Delete
if (this.evaluatorOptions.ignoreErrors) {
[58629] Fix | Delete
warn(`getContentStream - ignoring sub-stream (${objId}): "${reason}".`);
[58630] Fix | Delete
return;
[58631] Fix | Delete
}
[58632] Fix | Delete
throw reason;
[58633] Fix | Delete
}
[58634] Fix | Delete
getContentStream() {
[58635] Fix | Delete
return this.pdfManager.ensure(this, "content").then(content => {
[58636] Fix | Delete
if (content instanceof BaseStream) {
[58637] Fix | Delete
return content;
[58638] Fix | Delete
}
[58639] Fix | Delete
if (Array.isArray(content)) {
[58640] Fix | Delete
return new StreamsSequenceStream(content, this._onSubStreamError.bind(this));
[58641] Fix | Delete
}
[58642] Fix | Delete
return new NullStream();
[58643] Fix | Delete
});
[58644] Fix | Delete
}
[58645] Fix | Delete
get xfaData() {
[58646] Fix | Delete
return shadow(this, "xfaData", this.xfaFactory ? {
[58647] Fix | Delete
bbox: this.xfaFactory.getBoundingBox(this.pageIndex)
[58648] Fix | Delete
} : null);
[58649] Fix | Delete
}
[58650] Fix | Delete
#replaceIdByRef(annotations, deletedAnnotations, existingAnnotations) {
[58651] Fix | Delete
for (const annotation of annotations) {
[58652] Fix | Delete
if (annotation.id) {
[58653] Fix | Delete
const ref = Ref.fromString(annotation.id);
[58654] Fix | Delete
if (!ref) {
[58655] Fix | Delete
warn(`A non-linked annotation cannot be modified: ${annotation.id}`);
[58656] Fix | Delete
continue;
[58657] Fix | Delete
}
[58658] Fix | Delete
if (annotation.deleted) {
[58659] Fix | Delete
deletedAnnotations.put(ref, ref);
[58660] Fix | Delete
continue;
[58661] Fix | Delete
}
[58662] Fix | Delete
existingAnnotations?.put(ref);
[58663] Fix | Delete
annotation.ref = ref;
[58664] Fix | Delete
delete annotation.id;
[58665] Fix | Delete
}
[58666] Fix | Delete
}
[58667] Fix | Delete
}
[58668] Fix | Delete
async saveNewAnnotations(handler, task, annotations, imagePromises) {
[58669] Fix | Delete
if (this.xfaFactory) {
[58670] Fix | Delete
throw new Error("XFA: Cannot save new annotations.");
[58671] Fix | Delete
}
[58672] Fix | Delete
const partialEvaluator = new PartialEvaluator({
[58673] Fix | Delete
xref: this.xref,
[58674] Fix | Delete
handler,
[58675] Fix | Delete
pageIndex: this.pageIndex,
[58676] Fix | Delete
idFactory: this._localIdFactory,
[58677] Fix | Delete
fontCache: this.fontCache,
[58678] Fix | Delete
builtInCMapCache: this.builtInCMapCache,
[58679] Fix | Delete
standardFontDataCache: this.standardFontDataCache,
[58680] Fix | Delete
globalImageCache: this.globalImageCache,
[58681] Fix | Delete
systemFontCache: this.systemFontCache,
[58682] Fix | Delete
options: this.evaluatorOptions
[58683] Fix | Delete
});
[58684] Fix | Delete
const deletedAnnotations = new RefSetCache();
[58685] Fix | Delete
const existingAnnotations = new RefSet();
[58686] Fix | Delete
this.#replaceIdByRef(annotations, deletedAnnotations, existingAnnotations);
[58687] Fix | Delete
const pageDict = this.pageDict;
[58688] Fix | Delete
const annotationsArray = this.annotations.filter(a => !(a instanceof Ref && deletedAnnotations.has(a)));
[58689] Fix | Delete
const newData = await AnnotationFactory.saveNewAnnotations(partialEvaluator, task, annotations, imagePromises);
[58690] Fix | Delete
for (const {
[58691] Fix | Delete
ref
[58692] Fix | Delete
} of newData.annotations) {
[58693] Fix | Delete
if (ref instanceof Ref && !existingAnnotations.has(ref)) {
[58694] Fix | Delete
annotationsArray.push(ref);
[58695] Fix | Delete
}
[58696] Fix | Delete
}
[58697] Fix | Delete
const savedDict = pageDict.get("Annots");
[58698] Fix | Delete
pageDict.set("Annots", annotationsArray);
[58699] Fix | Delete
const buffer = [];
[58700] Fix | Delete
await writeObject(this.ref, pageDict, buffer, this.xref);
[58701] Fix | Delete
if (savedDict) {
[58702] Fix | Delete
pageDict.set("Annots", savedDict);
[58703] Fix | Delete
}
[58704] Fix | Delete
const objects = newData.dependencies;
[58705] Fix | Delete
objects.push({
[58706] Fix | Delete
ref: this.ref,
[58707] Fix | Delete
data: buffer.join("")
[58708] Fix | Delete
}, ...newData.annotations);
[58709] Fix | Delete
for (const deletedRef of deletedAnnotations) {
[58710] Fix | Delete
objects.push({
[58711] Fix | Delete
ref: deletedRef,
[58712] Fix | Delete
data: null
[58713] Fix | Delete
});
[58714] Fix | Delete
}
[58715] Fix | Delete
return objects;
[58716] Fix | Delete
}
[58717] Fix | Delete
save(handler, task, annotationStorage) {
[58718] Fix | Delete
const partialEvaluator = new PartialEvaluator({
[58719] Fix | Delete
xref: this.xref,
[58720] Fix | Delete
handler,
[58721] Fix | Delete
pageIndex: this.pageIndex,
[58722] Fix | Delete
idFactory: this._localIdFactory,
[58723] Fix | Delete
fontCache: this.fontCache,
[58724] Fix | Delete
builtInCMapCache: this.builtInCMapCache,
[58725] Fix | Delete
standardFontDataCache: this.standardFontDataCache,
[58726] Fix | Delete
globalImageCache: this.globalImageCache,
[58727] Fix | Delete
systemFontCache: this.systemFontCache,
[58728] Fix | Delete
options: this.evaluatorOptions
[58729] Fix | Delete
});
[58730] Fix | Delete
return this._parsedAnnotations.then(function (annotations) {
[58731] Fix | Delete
const newRefsPromises = [];
[58732] Fix | Delete
for (const annotation of annotations) {
[58733] Fix | Delete
if (!annotation.mustBePrinted(annotationStorage)) {
[58734] Fix | Delete
continue;
[58735] Fix | Delete
}
[58736] Fix | Delete
newRefsPromises.push(annotation.save(partialEvaluator, task, annotationStorage).catch(function (reason) {
[58737] Fix | Delete
warn("save - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
[58738] Fix | Delete
return null;
[58739] Fix | Delete
}));
[58740] Fix | Delete
}
[58741] Fix | Delete
return Promise.all(newRefsPromises).then(function (newRefs) {
[58742] Fix | Delete
return newRefs.filter(newRef => !!newRef);
[58743] Fix | Delete
});
[58744] Fix | Delete
});
[58745] Fix | Delete
}
[58746] Fix | Delete
loadResources(keys) {
[58747] Fix | Delete
this.resourcesPromise ||= this.pdfManager.ensure(this, "resources");
[58748] Fix | Delete
return this.resourcesPromise.then(() => {
[58749] Fix | Delete
const objectLoader = new ObjectLoader(this.resources, keys, this.xref);
[58750] Fix | Delete
return objectLoader.load();
[58751] Fix | Delete
});
[58752] Fix | Delete
}
[58753] Fix | Delete
getOperatorList({
[58754] Fix | Delete
handler,
[58755] Fix | Delete
sink,
[58756] Fix | Delete
task,
[58757] Fix | Delete
intent,
[58758] Fix | Delete
cacheKey,
[58759] Fix | Delete
annotationStorage = null
[58760] Fix | Delete
}) {
[58761] Fix | Delete
const contentStreamPromise = this.getContentStream();
[58762] Fix | Delete
const resourcesPromise = this.loadResources(["ColorSpace", "ExtGState", "Font", "Pattern", "Properties", "Shading", "XObject"]);
[58763] Fix | Delete
const partialEvaluator = new PartialEvaluator({
[58764] Fix | Delete
xref: this.xref,
[58765] Fix | Delete
handler,
[58766] Fix | Delete
pageIndex: this.pageIndex,
[58767] Fix | Delete
idFactory: this._localIdFactory,
[58768] Fix | Delete
fontCache: this.fontCache,
[58769] Fix | Delete
builtInCMapCache: this.builtInCMapCache,
[58770] Fix | Delete
standardFontDataCache: this.standardFontDataCache,
[58771] Fix | Delete
globalImageCache: this.globalImageCache,
[58772] Fix | Delete
systemFontCache: this.systemFontCache,
[58773] Fix | Delete
options: this.evaluatorOptions
[58774] Fix | Delete
});
[58775] Fix | Delete
const newAnnotsByPage = !this.xfaFactory ? getNewAnnotationsMap(annotationStorage) : null;
[58776] Fix | Delete
const newAnnots = newAnnotsByPage?.get(this.pageIndex);
[58777] Fix | Delete
let newAnnotationsPromise = Promise.resolve(null);
[58778] Fix | Delete
let deletedAnnotations = null;
[58779] Fix | Delete
if (newAnnots) {
[58780] Fix | Delete
const annotationGlobalsPromise = this.pdfManager.ensureDoc("annotationGlobals");
[58781] Fix | Delete
let imagePromises;
[58782] Fix | Delete
const missingBitmaps = new Set();
[58783] Fix | Delete
for (const {
[58784] Fix | Delete
bitmapId,
[58785] Fix | Delete
bitmap
[58786] Fix | Delete
} of newAnnots) {
[58787] Fix | Delete
if (bitmapId && !bitmap && !missingBitmaps.has(bitmapId)) {
[58788] Fix | Delete
missingBitmaps.add(bitmapId);
[58789] Fix | Delete
}
[58790] Fix | Delete
}
[58791] Fix | Delete
const {
[58792] Fix | Delete
isOffscreenCanvasSupported
[58793] Fix | Delete
} = this.evaluatorOptions;
[58794] Fix | Delete
if (missingBitmaps.size > 0) {
[58795] Fix | Delete
const annotationWithBitmaps = newAnnots.slice();
[58796] Fix | Delete
for (const [key, annotation] of annotationStorage) {
[58797] Fix | Delete
if (!key.startsWith(AnnotationEditorPrefix)) {
[58798] Fix | Delete
continue;
[58799] Fix | Delete
}
[58800] Fix | Delete
if (annotation.bitmap && missingBitmaps.has(annotation.bitmapId)) {
[58801] Fix | Delete
annotationWithBitmaps.push(annotation);
[58802] Fix | Delete
}
[58803] Fix | Delete
}
[58804] Fix | Delete
imagePromises = AnnotationFactory.generateImages(annotationWithBitmaps, this.xref, isOffscreenCanvasSupported);
[58805] Fix | Delete
} else {
[58806] Fix | Delete
imagePromises = AnnotationFactory.generateImages(newAnnots, this.xref, isOffscreenCanvasSupported);
[58807] Fix | Delete
}
[58808] Fix | Delete
deletedAnnotations = new RefSet();
[58809] Fix | Delete
this.#replaceIdByRef(newAnnots, deletedAnnotations, null);
[58810] Fix | Delete
newAnnotationsPromise = annotationGlobalsPromise.then(annotationGlobals => {
[58811] Fix | Delete
if (!annotationGlobals) {
[58812] Fix | Delete
return null;
[58813] Fix | Delete
}
[58814] Fix | Delete
return AnnotationFactory.printNewAnnotations(annotationGlobals, partialEvaluator, task, newAnnots, imagePromises);
[58815] Fix | Delete
});
[58816] Fix | Delete
}
[58817] Fix | Delete
const pageListPromise = Promise.all([contentStreamPromise, resourcesPromise]).then(([contentStream]) => {
[58818] Fix | Delete
const opList = new OperatorList(intent, sink);
[58819] Fix | Delete
handler.send("StartRenderPage", {
[58820] Fix | Delete
transparency: partialEvaluator.hasBlendModes(this.resources, this.nonBlendModesSet),
[58821] Fix | Delete
pageIndex: this.pageIndex,
[58822] Fix | Delete
cacheKey
[58823] Fix | Delete
});
[58824] Fix | Delete
return partialEvaluator.getOperatorList({
[58825] Fix | Delete
stream: contentStream,
[58826] Fix | Delete
task,
[58827] Fix | Delete
resources: this.resources,
[58828] Fix | Delete
operatorList: opList
[58829] Fix | Delete
}).then(function () {
[58830] Fix | Delete
return opList;
[58831] Fix | Delete
});
[58832] Fix | Delete
});
[58833] Fix | Delete
return Promise.all([pageListPromise, this._parsedAnnotations, newAnnotationsPromise]).then(function ([pageOpList, annotations, newAnnotations]) {
[58834] Fix | Delete
if (newAnnotations) {
[58835] Fix | Delete
annotations = annotations.filter(a => !(a.ref && deletedAnnotations.has(a.ref)));
[58836] Fix | Delete
for (let i = 0, ii = newAnnotations.length; i < ii; i++) {
[58837] Fix | Delete
const newAnnotation = newAnnotations[i];
[58838] Fix | Delete
if (newAnnotation.refToReplace) {
[58839] Fix | Delete
const j = annotations.findIndex(a => a.ref && isRefsEqual(a.ref, newAnnotation.refToReplace));
[58840] Fix | Delete
if (j >= 0) {
[58841] Fix | Delete
annotations.splice(j, 1, newAnnotation);
[58842] Fix | Delete
newAnnotations.splice(i--, 1);
[58843] Fix | Delete
ii--;
[58844] Fix | Delete
}
[58845] Fix | Delete
}
[58846] Fix | Delete
}
[58847] Fix | Delete
annotations = annotations.concat(newAnnotations);
[58848] Fix | Delete
}
[58849] Fix | Delete
if (annotations.length === 0 || intent & RenderingIntentFlag.ANNOTATIONS_DISABLE) {
[58850] Fix | Delete
pageOpList.flush(true);
[58851] Fix | Delete
return {
[58852] Fix | Delete
length: pageOpList.totalLength
[58853] Fix | Delete
};
[58854] Fix | Delete
}
[58855] Fix | Delete
const renderForms = !!(intent & RenderingIntentFlag.ANNOTATIONS_FORMS),
[58856] Fix | Delete
intentAny = !!(intent & RenderingIntentFlag.ANY),
[58857] Fix | Delete
intentDisplay = !!(intent & RenderingIntentFlag.DISPLAY),
[58858] Fix | Delete
intentPrint = !!(intent & RenderingIntentFlag.PRINT);
[58859] Fix | Delete
const opListPromises = [];
[58860] Fix | Delete
for (const annotation of annotations) {
[58861] Fix | Delete
if (intentAny || intentDisplay && annotation.mustBeViewed(annotationStorage, renderForms) || intentPrint && annotation.mustBePrinted(annotationStorage)) {
[58862] Fix | Delete
opListPromises.push(annotation.getOperatorList(partialEvaluator, task, intent, renderForms, annotationStorage).catch(function (reason) {
[58863] Fix | Delete
warn("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
[58864] Fix | Delete
return {
[58865] Fix | Delete
opList: null,
[58866] Fix | Delete
separateForm: false,
[58867] Fix | Delete
separateCanvas: false
[58868] Fix | Delete
};
[58869] Fix | Delete
}));
[58870] Fix | Delete
}
[58871] Fix | Delete
}
[58872] Fix | Delete
return Promise.all(opListPromises).then(function (opLists) {
[58873] Fix | Delete
let form = false,
[58874] Fix | Delete
canvas = false;
[58875] Fix | Delete
for (const {
[58876] Fix | Delete
opList,
[58877] Fix | Delete
separateForm,
[58878] Fix | Delete
separateCanvas
[58879] Fix | Delete
} of opLists) {
[58880] Fix | Delete
pageOpList.addOpList(opList);
[58881] Fix | Delete
form ||= separateForm;
[58882] Fix | Delete
canvas ||= separateCanvas;
[58883] Fix | Delete
}
[58884] Fix | Delete
pageOpList.flush(true, {
[58885] Fix | Delete
form,
[58886] Fix | Delete
canvas
[58887] Fix | Delete
});
[58888] Fix | Delete
return {
[58889] Fix | Delete
length: pageOpList.totalLength
[58890] Fix | Delete
};
[58891] Fix | Delete
});
[58892] Fix | Delete
});
[58893] Fix | Delete
}
[58894] Fix | Delete
async extractTextContent({
[58895] Fix | Delete
handler,
[58896] Fix | Delete
task,
[58897] Fix | Delete
includeMarkedContent,
[58898] Fix | Delete
disableNormalization,
[58899] Fix | Delete
sink
[58900] Fix | Delete
}) {
[58901] Fix | Delete
const contentStreamPromise = this.getContentStream();
[58902] Fix | Delete
const resourcesPromise = this.loadResources(["ExtGState", "Font", "Properties", "XObject"]);
[58903] Fix | Delete
const langPromise = this.pdfManager.ensureCatalog("lang");
[58904] Fix | Delete
const [contentStream,, lang] = await Promise.all([contentStreamPromise, resourcesPromise, langPromise]);
[58905] Fix | Delete
const partialEvaluator = new PartialEvaluator({
[58906] Fix | Delete
xref: this.xref,
[58907] Fix | Delete
handler,
[58908] Fix | Delete
pageIndex: this.pageIndex,
[58909] Fix | Delete
idFactory: this._localIdFactory,
[58910] Fix | Delete
fontCache: this.fontCache,
[58911] Fix | Delete
builtInCMapCache: this.builtInCMapCache,
[58912] Fix | Delete
standardFontDataCache: this.standardFontDataCache,
[58913] Fix | Delete
globalImageCache: this.globalImageCache,
[58914] Fix | Delete
systemFontCache: this.systemFontCache,
[58915] Fix | Delete
options: this.evaluatorOptions
[58916] Fix | Delete
});
[58917] Fix | Delete
return partialEvaluator.getTextContent({
[58918] Fix | Delete
stream: contentStream,
[58919] Fix | Delete
task,
[58920] Fix | Delete
resources: this.resources,
[58921] Fix | Delete
includeMarkedContent,
[58922] Fix | Delete
disableNormalization,
[58923] Fix | Delete
sink,
[58924] Fix | Delete
viewBox: this.view,
[58925] Fix | Delete
lang
[58926] Fix | Delete
});
[58927] Fix | Delete
}
[58928] Fix | Delete
async getStructTree() {
[58929] Fix | Delete
const structTreeRoot = await this.pdfManager.ensureCatalog("structTreeRoot");
[58930] Fix | Delete
if (!structTreeRoot) {
[58931] Fix | Delete
return null;
[58932] Fix | Delete
}
[58933] Fix | Delete
await this._parsedAnnotations;
[58934] Fix | Delete
const structTree = await this.pdfManager.ensure(this, "_parseStructTree", [structTreeRoot]);
[58935] Fix | Delete
return structTree.serializable;
[58936] Fix | Delete
}
[58937] Fix | Delete
_parseStructTree(structTreeRoot) {
[58938] Fix | Delete
const tree = new StructTreePage(structTreeRoot, this.pageDict);
[58939] Fix | Delete
tree.parse(this.ref);
[58940] Fix | Delete
return tree;
[58941] Fix | Delete
}
[58942] Fix | Delete
async getAnnotationsData(handler, task, intent) {
[58943] Fix | Delete
const annotations = await this._parsedAnnotations;
[58944] Fix | Delete
if (annotations.length === 0) {
[58945] Fix | Delete
return annotations;
[58946] Fix | Delete
}
[58947] Fix | Delete
const annotationsData = [],
[58948] Fix | Delete
textContentPromises = [];
[58949] Fix | Delete
let partialEvaluator;
[58950] Fix | Delete
const intentAny = !!(intent & RenderingIntentFlag.ANY),
[58951] Fix | Delete
intentDisplay = !!(intent & RenderingIntentFlag.DISPLAY),
[58952] Fix | Delete
intentPrint = !!(intent & RenderingIntentFlag.PRINT);
[58953] Fix | Delete
for (const annotation of annotations) {
[58954] Fix | Delete
const isVisible = intentAny || intentDisplay && annotation.viewable;
[58955] Fix | Delete
if (isVisible || intentPrint && annotation.printable) {
[58956] Fix | Delete
annotationsData.push(annotation.data);
[58957] Fix | Delete
}
[58958] Fix | Delete
if (annotation.hasTextContent && isVisible) {
[58959] Fix | Delete
partialEvaluator ||= new PartialEvaluator({
[58960] Fix | Delete
xref: this.xref,
[58961] Fix | Delete
handler,
[58962] Fix | Delete
pageIndex: this.pageIndex,
[58963] Fix | Delete
idFactory: this._localIdFactory,
[58964] Fix | Delete
fontCache: this.fontCache,
[58965] Fix | Delete
builtInCMapCache: this.builtInCMapCache,
[58966] Fix | Delete
standardFontDataCache: this.standardFontDataCache,
[58967] Fix | Delete
globalImageCache: this.globalImageCache,
[58968] Fix | Delete
systemFontCache: this.systemFontCache,
[58969] Fix | Delete
options: this.evaluatorOptions
[58970] Fix | Delete
});
[58971] Fix | Delete
textContentPromises.push(annotation.extractTextContent(partialEvaluator, task, [-Infinity, -Infinity, Infinity, Infinity]).catch(function (reason) {
[58972] Fix | Delete
warn(`getAnnotationsData - ignoring textContent during "${task.name}" task: "${reason}".`);
[58973] Fix | Delete
}));
[58974] Fix | Delete
}
[58975] Fix | Delete
}
[58976] Fix | Delete
await Promise.all(textContentPromises);
[58977] Fix | Delete
return annotationsData;
[58978] Fix | Delete
}
[58979] Fix | Delete
get annotations() {
[58980] Fix | Delete
const annots = this._getInheritableProperty("Annots");
[58981] Fix | Delete
return shadow(this, "annotations", Array.isArray(annots) ? annots : []);
[58982] Fix | Delete
}
[58983] Fix | Delete
get _parsedAnnotations() {
[58984] Fix | Delete
const promise = this.pdfManager.ensure(this, "annotations").then(async annots => {
[58985] Fix | Delete
if (annots.length === 0) {
[58986] Fix | Delete
return annots;
[58987] Fix | Delete
}
[58988] Fix | Delete
const annotationGlobals = await this.pdfManager.ensureDoc("annotationGlobals");
[58989] Fix | Delete
if (!annotationGlobals) {
[58990] Fix | Delete
return [];
[58991] Fix | Delete
}
[58992] Fix | Delete
const annotationPromises = [];
[58993] Fix | Delete
for (const annotationRef of annots) {
[58994] Fix | Delete
annotationPromises.push(AnnotationFactory.create(this.xref, annotationRef, annotationGlobals, this._localIdFactory, false, this.ref).catch(function (reason) {
[58995] Fix | Delete
warn(`_parsedAnnotations: "${reason}".`);
[58996] Fix | Delete
return null;
[58997] Fix | Delete
}));
[58998] Fix | Delete
}
[58999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function