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/clone/wp-conte.../plugins/embedpre.../assets/pdf/build
File: pdf.worker.js
localImageCache.set(cacheKey, imageRef, cacheData);
[35000] Fix | Delete
if (imageRef) {
[35001] Fix | Delete
this._regionalImageCache.set(null, imageRef, cacheData);
[35002] Fix | Delete
if (cacheGlobally) {
[35003] Fix | Delete
this.globalImageCache.setData(imageRef, {
[35004] Fix | Delete
objId,
[35005] Fix | Delete
fn: OPS.paintImageXObject,
[35006] Fix | Delete
args,
[35007] Fix | Delete
optionalContent,
[35008] Fix | Delete
byteSize: 0
[35009] Fix | Delete
});
[35010] Fix | Delete
}
[35011] Fix | Delete
}
[35012] Fix | Delete
}
[35013] Fix | Delete
}
[35014] Fix | Delete
handleSMask(smask, resources, operatorList, task, stateManager, localColorSpaceCache) {
[35015] Fix | Delete
const smaskContent = smask.get("G");
[35016] Fix | Delete
const smaskOptions = {
[35017] Fix | Delete
subtype: smask.get("S").name,
[35018] Fix | Delete
backdrop: smask.get("BC")
[35019] Fix | Delete
};
[35020] Fix | Delete
const transferObj = smask.get("TR");
[35021] Fix | Delete
if (isPDFFunction(transferObj)) {
[35022] Fix | Delete
const transferFn = this._pdfFunctionFactory.create(transferObj);
[35023] Fix | Delete
const transferMap = new Uint8Array(256);
[35024] Fix | Delete
const tmp = new Float32Array(1);
[35025] Fix | Delete
for (let i = 0; i < 256; i++) {
[35026] Fix | Delete
tmp[0] = i / 255;
[35027] Fix | Delete
transferFn(tmp, 0, tmp, 0);
[35028] Fix | Delete
transferMap[i] = tmp[0] * 255 | 0;
[35029] Fix | Delete
}
[35030] Fix | Delete
smaskOptions.transferMap = transferMap;
[35031] Fix | Delete
}
[35032] Fix | Delete
return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone(), localColorSpaceCache);
[35033] Fix | Delete
}
[35034] Fix | Delete
handleTransferFunction(tr) {
[35035] Fix | Delete
let transferArray;
[35036] Fix | Delete
if (Array.isArray(tr)) {
[35037] Fix | Delete
transferArray = tr;
[35038] Fix | Delete
} else if (isPDFFunction(tr)) {
[35039] Fix | Delete
transferArray = [tr];
[35040] Fix | Delete
} else {
[35041] Fix | Delete
return null;
[35042] Fix | Delete
}
[35043] Fix | Delete
const transferMaps = [];
[35044] Fix | Delete
let numFns = 0,
[35045] Fix | Delete
numEffectfulFns = 0;
[35046] Fix | Delete
for (const entry of transferArray) {
[35047] Fix | Delete
const transferObj = this.xref.fetchIfRef(entry);
[35048] Fix | Delete
numFns++;
[35049] Fix | Delete
if (isName(transferObj, "Identity")) {
[35050] Fix | Delete
transferMaps.push(null);
[35051] Fix | Delete
continue;
[35052] Fix | Delete
} else if (!isPDFFunction(transferObj)) {
[35053] Fix | Delete
return null;
[35054] Fix | Delete
}
[35055] Fix | Delete
const transferFn = this._pdfFunctionFactory.create(transferObj);
[35056] Fix | Delete
const transferMap = new Uint8Array(256),
[35057] Fix | Delete
tmp = new Float32Array(1);
[35058] Fix | Delete
for (let j = 0; j < 256; j++) {
[35059] Fix | Delete
tmp[0] = j / 255;
[35060] Fix | Delete
transferFn(tmp, 0, tmp, 0);
[35061] Fix | Delete
transferMap[j] = tmp[0] * 255 | 0;
[35062] Fix | Delete
}
[35063] Fix | Delete
transferMaps.push(transferMap);
[35064] Fix | Delete
numEffectfulFns++;
[35065] Fix | Delete
}
[35066] Fix | Delete
if (!(numFns === 1 || numFns === 4)) {
[35067] Fix | Delete
return null;
[35068] Fix | Delete
}
[35069] Fix | Delete
if (numEffectfulFns === 0) {
[35070] Fix | Delete
return null;
[35071] Fix | Delete
}
[35072] Fix | Delete
return transferMaps;
[35073] Fix | Delete
}
[35074] Fix | Delete
handleTilingType(fn, color, resources, pattern, patternDict, operatorList, task, localTilingPatternCache) {
[35075] Fix | Delete
const tilingOpList = new OperatorList();
[35076] Fix | Delete
const patternResources = Dict.merge({
[35077] Fix | Delete
xref: this.xref,
[35078] Fix | Delete
dictArray: [patternDict.get("Resources"), resources]
[35079] Fix | Delete
});
[35080] Fix | Delete
return this.getOperatorList({
[35081] Fix | Delete
stream: pattern,
[35082] Fix | Delete
task,
[35083] Fix | Delete
resources: patternResources,
[35084] Fix | Delete
operatorList: tilingOpList
[35085] Fix | Delete
}).then(function () {
[35086] Fix | Delete
const operatorListIR = tilingOpList.getIR();
[35087] Fix | Delete
const tilingPatternIR = getTilingPatternIR(operatorListIR, patternDict, color);
[35088] Fix | Delete
operatorList.addDependencies(tilingOpList.dependencies);
[35089] Fix | Delete
operatorList.addOp(fn, tilingPatternIR);
[35090] Fix | Delete
if (patternDict.objId) {
[35091] Fix | Delete
localTilingPatternCache.set(null, patternDict.objId, {
[35092] Fix | Delete
operatorListIR,
[35093] Fix | Delete
dict: patternDict
[35094] Fix | Delete
});
[35095] Fix | Delete
}
[35096] Fix | Delete
}).catch(reason => {
[35097] Fix | Delete
if (reason instanceof AbortException) {
[35098] Fix | Delete
return;
[35099] Fix | Delete
}
[35100] Fix | Delete
if (this.options.ignoreErrors) {
[35101] Fix | Delete
warn(`handleTilingType - ignoring pattern: "${reason}".`);
[35102] Fix | Delete
return;
[35103] Fix | Delete
}
[35104] Fix | Delete
throw reason;
[35105] Fix | Delete
});
[35106] Fix | Delete
}
[35107] Fix | Delete
async handleSetFont(resources, fontArgs, fontRef, operatorList, task, state, fallbackFontDict = null, cssFontInfo = null) {
[35108] Fix | Delete
const fontName = fontArgs?.[0] instanceof Name ? fontArgs[0].name : null;
[35109] Fix | Delete
let translated = await this.loadFont(fontName, fontRef, resources, fallbackFontDict, cssFontInfo);
[35110] Fix | Delete
if (translated.font.isType3Font) {
[35111] Fix | Delete
try {
[35112] Fix | Delete
await translated.loadType3Data(this, resources, task);
[35113] Fix | Delete
operatorList.addDependencies(translated.type3Dependencies);
[35114] Fix | Delete
} catch (reason) {
[35115] Fix | Delete
translated = new TranslatedFont({
[35116] Fix | Delete
loadedName: "g_font_error",
[35117] Fix | Delete
font: new ErrorFont(`Type3 font load error: ${reason}`),
[35118] Fix | Delete
dict: translated.font,
[35119] Fix | Delete
evaluatorOptions: this.options
[35120] Fix | Delete
});
[35121] Fix | Delete
}
[35122] Fix | Delete
}
[35123] Fix | Delete
state.font = translated.font;
[35124] Fix | Delete
translated.send(this.handler);
[35125] Fix | Delete
return translated.loadedName;
[35126] Fix | Delete
}
[35127] Fix | Delete
handleText(chars, state) {
[35128] Fix | Delete
const font = state.font;
[35129] Fix | Delete
const glyphs = font.charsToGlyphs(chars);
[35130] Fix | Delete
if (font.data) {
[35131] Fix | Delete
const isAddToPathSet = !!(state.textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG);
[35132] Fix | Delete
if (isAddToPathSet || state.fillColorSpace.name === "Pattern" || font.disableFontFace || this.options.disableFontFace) {
[35133] Fix | Delete
PartialEvaluator.buildFontPaths(font, glyphs, this.handler, this.options);
[35134] Fix | Delete
}
[35135] Fix | Delete
}
[35136] Fix | Delete
return glyphs;
[35137] Fix | Delete
}
[35138] Fix | Delete
ensureStateFont(state) {
[35139] Fix | Delete
if (state.font) {
[35140] Fix | Delete
return;
[35141] Fix | Delete
}
[35142] Fix | Delete
const reason = new FormatError("Missing setFont (Tf) operator before text rendering operator.");
[35143] Fix | Delete
if (this.options.ignoreErrors) {
[35144] Fix | Delete
warn(`ensureStateFont: "${reason}".`);
[35145] Fix | Delete
return;
[35146] Fix | Delete
}
[35147] Fix | Delete
throw reason;
[35148] Fix | Delete
}
[35149] Fix | Delete
async setGState({
[35150] Fix | Delete
resources,
[35151] Fix | Delete
gState,
[35152] Fix | Delete
operatorList,
[35153] Fix | Delete
cacheKey,
[35154] Fix | Delete
task,
[35155] Fix | Delete
stateManager,
[35156] Fix | Delete
localGStateCache,
[35157] Fix | Delete
localColorSpaceCache
[35158] Fix | Delete
}) {
[35159] Fix | Delete
const gStateRef = gState.objId;
[35160] Fix | Delete
let isSimpleGState = true;
[35161] Fix | Delete
const gStateObj = [];
[35162] Fix | Delete
let promise = Promise.resolve();
[35163] Fix | Delete
for (const key of gState.getKeys()) {
[35164] Fix | Delete
const value = gState.get(key);
[35165] Fix | Delete
switch (key) {
[35166] Fix | Delete
case "Type":
[35167] Fix | Delete
break;
[35168] Fix | Delete
case "LW":
[35169] Fix | Delete
case "LC":
[35170] Fix | Delete
case "LJ":
[35171] Fix | Delete
case "ML":
[35172] Fix | Delete
case "D":
[35173] Fix | Delete
case "RI":
[35174] Fix | Delete
case "FL":
[35175] Fix | Delete
case "CA":
[35176] Fix | Delete
case "ca":
[35177] Fix | Delete
gStateObj.push([key, value]);
[35178] Fix | Delete
break;
[35179] Fix | Delete
case "Font":
[35180] Fix | Delete
isSimpleGState = false;
[35181] Fix | Delete
promise = promise.then(() => this.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
[35182] Fix | Delete
operatorList.addDependency(loadedName);
[35183] Fix | Delete
gStateObj.push([key, [loadedName, value[1]]]);
[35184] Fix | Delete
}));
[35185] Fix | Delete
break;
[35186] Fix | Delete
case "BM":
[35187] Fix | Delete
gStateObj.push([key, normalizeBlendMode(value)]);
[35188] Fix | Delete
break;
[35189] Fix | Delete
case "SMask":
[35190] Fix | Delete
if (isName(value, "None")) {
[35191] Fix | Delete
gStateObj.push([key, false]);
[35192] Fix | Delete
break;
[35193] Fix | Delete
}
[35194] Fix | Delete
if (value instanceof Dict) {
[35195] Fix | Delete
isSimpleGState = false;
[35196] Fix | Delete
promise = promise.then(() => this.handleSMask(value, resources, operatorList, task, stateManager, localColorSpaceCache));
[35197] Fix | Delete
gStateObj.push([key, true]);
[35198] Fix | Delete
} else {
[35199] Fix | Delete
warn("Unsupported SMask type");
[35200] Fix | Delete
}
[35201] Fix | Delete
break;
[35202] Fix | Delete
case "TR":
[35203] Fix | Delete
const transferMaps = this.handleTransferFunction(value);
[35204] Fix | Delete
gStateObj.push([key, transferMaps]);
[35205] Fix | Delete
break;
[35206] Fix | Delete
case "OP":
[35207] Fix | Delete
case "op":
[35208] Fix | Delete
case "OPM":
[35209] Fix | Delete
case "BG":
[35210] Fix | Delete
case "BG2":
[35211] Fix | Delete
case "UCR":
[35212] Fix | Delete
case "UCR2":
[35213] Fix | Delete
case "TR2":
[35214] Fix | Delete
case "HT":
[35215] Fix | Delete
case "SM":
[35216] Fix | Delete
case "SA":
[35217] Fix | Delete
case "AIS":
[35218] Fix | Delete
case "TK":
[35219] Fix | Delete
info("graphic state operator " + key);
[35220] Fix | Delete
break;
[35221] Fix | Delete
default:
[35222] Fix | Delete
info("Unknown graphic state operator " + key);
[35223] Fix | Delete
break;
[35224] Fix | Delete
}
[35225] Fix | Delete
}
[35226] Fix | Delete
await promise;
[35227] Fix | Delete
if (gStateObj.length > 0) {
[35228] Fix | Delete
operatorList.addOp(OPS.setGState, [gStateObj]);
[35229] Fix | Delete
}
[35230] Fix | Delete
if (isSimpleGState) {
[35231] Fix | Delete
localGStateCache.set(cacheKey, gStateRef, gStateObj);
[35232] Fix | Delete
}
[35233] Fix | Delete
}
[35234] Fix | Delete
loadFont(fontName, font, resources, fallbackFontDict = null, cssFontInfo = null) {
[35235] Fix | Delete
const errorFont = async () => {
[35236] Fix | Delete
return new TranslatedFont({
[35237] Fix | Delete
loadedName: "g_font_error",
[35238] Fix | Delete
font: new ErrorFont(`Font "${fontName}" is not available.`),
[35239] Fix | Delete
dict: font,
[35240] Fix | Delete
evaluatorOptions: this.options
[35241] Fix | Delete
});
[35242] Fix | Delete
};
[35243] Fix | Delete
let fontRef;
[35244] Fix | Delete
if (font) {
[35245] Fix | Delete
if (font instanceof Ref) {
[35246] Fix | Delete
fontRef = font;
[35247] Fix | Delete
}
[35248] Fix | Delete
} else {
[35249] Fix | Delete
const fontRes = resources.get("Font");
[35250] Fix | Delete
if (fontRes) {
[35251] Fix | Delete
fontRef = fontRes.getRaw(fontName);
[35252] Fix | Delete
}
[35253] Fix | Delete
}
[35254] Fix | Delete
if (fontRef) {
[35255] Fix | Delete
if (this.type3FontRefs?.has(fontRef)) {
[35256] Fix | Delete
return errorFont();
[35257] Fix | Delete
}
[35258] Fix | Delete
if (this.fontCache.has(fontRef)) {
[35259] Fix | Delete
return this.fontCache.get(fontRef);
[35260] Fix | Delete
}
[35261] Fix | Delete
try {
[35262] Fix | Delete
font = this.xref.fetchIfRef(fontRef);
[35263] Fix | Delete
} catch (ex) {
[35264] Fix | Delete
warn(`loadFont - lookup failed: "${ex}".`);
[35265] Fix | Delete
}
[35266] Fix | Delete
}
[35267] Fix | Delete
if (!(font instanceof Dict)) {
[35268] Fix | Delete
if (!this.options.ignoreErrors && !this.parsingType3Font) {
[35269] Fix | Delete
warn(`Font "${fontName}" is not available.`);
[35270] Fix | Delete
return errorFont();
[35271] Fix | Delete
}
[35272] Fix | Delete
warn(`Font "${fontName}" is not available -- attempting to fallback to a default font.`);
[35273] Fix | Delete
font = fallbackFontDict || PartialEvaluator.fallbackFontDict;
[35274] Fix | Delete
}
[35275] Fix | Delete
if (font.cacheKey && this.fontCache.has(font.cacheKey)) {
[35276] Fix | Delete
return this.fontCache.get(font.cacheKey);
[35277] Fix | Delete
}
[35278] Fix | Delete
const {
[35279] Fix | Delete
promise,
[35280] Fix | Delete
resolve
[35281] Fix | Delete
} = Promise.withResolvers();
[35282] Fix | Delete
let preEvaluatedFont;
[35283] Fix | Delete
try {
[35284] Fix | Delete
preEvaluatedFont = this.preEvaluateFont(font);
[35285] Fix | Delete
preEvaluatedFont.cssFontInfo = cssFontInfo;
[35286] Fix | Delete
} catch (reason) {
[35287] Fix | Delete
warn(`loadFont - preEvaluateFont failed: "${reason}".`);
[35288] Fix | Delete
return errorFont();
[35289] Fix | Delete
}
[35290] Fix | Delete
const {
[35291] Fix | Delete
descriptor,
[35292] Fix | Delete
hash
[35293] Fix | Delete
} = preEvaluatedFont;
[35294] Fix | Delete
const fontRefIsRef = fontRef instanceof Ref;
[35295] Fix | Delete
let fontID;
[35296] Fix | Delete
if (hash && descriptor instanceof Dict) {
[35297] Fix | Delete
const fontAliases = descriptor.fontAliases ||= Object.create(null);
[35298] Fix | Delete
if (fontAliases[hash]) {
[35299] Fix | Delete
const aliasFontRef = fontAliases[hash].aliasRef;
[35300] Fix | Delete
if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
[35301] Fix | Delete
this.fontCache.putAlias(fontRef, aliasFontRef);
[35302] Fix | Delete
return this.fontCache.get(fontRef);
[35303] Fix | Delete
}
[35304] Fix | Delete
} else {
[35305] Fix | Delete
fontAliases[hash] = {
[35306] Fix | Delete
fontID: this.idFactory.createFontId()
[35307] Fix | Delete
};
[35308] Fix | Delete
}
[35309] Fix | Delete
if (fontRefIsRef) {
[35310] Fix | Delete
fontAliases[hash].aliasRef = fontRef;
[35311] Fix | Delete
}
[35312] Fix | Delete
fontID = fontAliases[hash].fontID;
[35313] Fix | Delete
} else {
[35314] Fix | Delete
fontID = this.idFactory.createFontId();
[35315] Fix | Delete
}
[35316] Fix | Delete
assert(fontID?.startsWith("f"), 'The "fontID" must be (correctly) defined.');
[35317] Fix | Delete
if (fontRefIsRef) {
[35318] Fix | Delete
this.fontCache.put(fontRef, promise);
[35319] Fix | Delete
} else {
[35320] Fix | Delete
font.cacheKey = `cacheKey_${fontID}`;
[35321] Fix | Delete
this.fontCache.put(font.cacheKey, promise);
[35322] Fix | Delete
}
[35323] Fix | Delete
font.loadedName = `${this.idFactory.getDocId()}_${fontID}`;
[35324] Fix | Delete
this.translateFont(preEvaluatedFont).then(translatedFont => {
[35325] Fix | Delete
resolve(new TranslatedFont({
[35326] Fix | Delete
loadedName: font.loadedName,
[35327] Fix | Delete
font: translatedFont,
[35328] Fix | Delete
dict: font,
[35329] Fix | Delete
evaluatorOptions: this.options
[35330] Fix | Delete
}));
[35331] Fix | Delete
}).catch(reason => {
[35332] Fix | Delete
warn(`loadFont - translateFont failed: "${reason}".`);
[35333] Fix | Delete
resolve(new TranslatedFont({
[35334] Fix | Delete
loadedName: font.loadedName,
[35335] Fix | Delete
font: new ErrorFont(reason instanceof Error ? reason.message : reason),
[35336] Fix | Delete
dict: font,
[35337] Fix | Delete
evaluatorOptions: this.options
[35338] Fix | Delete
}));
[35339] Fix | Delete
});
[35340] Fix | Delete
return promise;
[35341] Fix | Delete
}
[35342] Fix | Delete
buildPath(operatorList, fn, args, parsingText = false) {
[35343] Fix | Delete
const lastIndex = operatorList.length - 1;
[35344] Fix | Delete
if (!args) {
[35345] Fix | Delete
args = [];
[35346] Fix | Delete
}
[35347] Fix | Delete
if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== OPS.constructPath) {
[35348] Fix | Delete
if (parsingText) {
[35349] Fix | Delete
warn(`Encountered path operator "${fn}" inside of a text object.`);
[35350] Fix | Delete
operatorList.addOp(OPS.save, null);
[35351] Fix | Delete
}
[35352] Fix | Delete
let minMax;
[35353] Fix | Delete
switch (fn) {
[35354] Fix | Delete
case OPS.rectangle:
[35355] Fix | Delete
const x = args[0] + args[2];
[35356] Fix | Delete
const y = args[1] + args[3];
[35357] Fix | Delete
minMax = [Math.min(args[0], x), Math.min(args[1], y), Math.max(args[0], x), Math.max(args[1], y)];
[35358] Fix | Delete
break;
[35359] Fix | Delete
case OPS.moveTo:
[35360] Fix | Delete
case OPS.lineTo:
[35361] Fix | Delete
minMax = [args[0], args[1], args[0], args[1]];
[35362] Fix | Delete
break;
[35363] Fix | Delete
default:
[35364] Fix | Delete
minMax = [Infinity, Infinity, -Infinity, -Infinity];
[35365] Fix | Delete
break;
[35366] Fix | Delete
}
[35367] Fix | Delete
operatorList.addOp(OPS.constructPath, [[fn], args, minMax]);
[35368] Fix | Delete
if (parsingText) {
[35369] Fix | Delete
operatorList.addOp(OPS.restore, null);
[35370] Fix | Delete
}
[35371] Fix | Delete
} else {
[35372] Fix | Delete
const opArgs = operatorList.argsArray[lastIndex];
[35373] Fix | Delete
opArgs[0].push(fn);
[35374] Fix | Delete
opArgs[1].push(...args);
[35375] Fix | Delete
const minMax = opArgs[2];
[35376] Fix | Delete
switch (fn) {
[35377] Fix | Delete
case OPS.rectangle:
[35378] Fix | Delete
const x = args[0] + args[2];
[35379] Fix | Delete
const y = args[1] + args[3];
[35380] Fix | Delete
minMax[0] = Math.min(minMax[0], args[0], x);
[35381] Fix | Delete
minMax[1] = Math.min(minMax[1], args[1], y);
[35382] Fix | Delete
minMax[2] = Math.max(minMax[2], args[0], x);
[35383] Fix | Delete
minMax[3] = Math.max(minMax[3], args[1], y);
[35384] Fix | Delete
break;
[35385] Fix | Delete
case OPS.moveTo:
[35386] Fix | Delete
case OPS.lineTo:
[35387] Fix | Delete
minMax[0] = Math.min(minMax[0], args[0]);
[35388] Fix | Delete
minMax[1] = Math.min(minMax[1], args[1]);
[35389] Fix | Delete
minMax[2] = Math.max(minMax[2], args[0]);
[35390] Fix | Delete
minMax[3] = Math.max(minMax[3], args[1]);
[35391] Fix | Delete
break;
[35392] Fix | Delete
}
[35393] Fix | Delete
}
[35394] Fix | Delete
}
[35395] Fix | Delete
parseColorSpace({
[35396] Fix | Delete
cs,
[35397] Fix | Delete
resources,
[35398] Fix | Delete
localColorSpaceCache
[35399] Fix | Delete
}) {
[35400] Fix | Delete
return ColorSpace.parseAsync({
[35401] Fix | Delete
cs,
[35402] Fix | Delete
xref: this.xref,
[35403] Fix | Delete
resources,
[35404] Fix | Delete
pdfFunctionFactory: this._pdfFunctionFactory,
[35405] Fix | Delete
localColorSpaceCache
[35406] Fix | Delete
}).catch(reason => {
[35407] Fix | Delete
if (reason instanceof AbortException) {
[35408] Fix | Delete
return null;
[35409] Fix | Delete
}
[35410] Fix | Delete
if (this.options.ignoreErrors) {
[35411] Fix | Delete
warn(`parseColorSpace - ignoring ColorSpace: "${reason}".`);
[35412] Fix | Delete
return null;
[35413] Fix | Delete
}
[35414] Fix | Delete
throw reason;
[35415] Fix | Delete
});
[35416] Fix | Delete
}
[35417] Fix | Delete
parseShading({
[35418] Fix | Delete
shading,
[35419] Fix | Delete
resources,
[35420] Fix | Delete
localColorSpaceCache,
[35421] Fix | Delete
localShadingPatternCache
[35422] Fix | Delete
}) {
[35423] Fix | Delete
let id = localShadingPatternCache.get(shading);
[35424] Fix | Delete
if (id) {
[35425] Fix | Delete
return id;
[35426] Fix | Delete
}
[35427] Fix | Delete
let patternIR;
[35428] Fix | Delete
try {
[35429] Fix | Delete
const shadingFill = Pattern.parseShading(shading, this.xref, resources, this._pdfFunctionFactory, localColorSpaceCache);
[35430] Fix | Delete
patternIR = shadingFill.getIR();
[35431] Fix | Delete
} catch (reason) {
[35432] Fix | Delete
if (reason instanceof AbortException) {
[35433] Fix | Delete
return null;
[35434] Fix | Delete
}
[35435] Fix | Delete
if (this.options.ignoreErrors) {
[35436] Fix | Delete
warn(`parseShading - ignoring shading: "${reason}".`);
[35437] Fix | Delete
localShadingPatternCache.set(shading, null);
[35438] Fix | Delete
return null;
[35439] Fix | Delete
}
[35440] Fix | Delete
throw reason;
[35441] Fix | Delete
}
[35442] Fix | Delete
id = `pattern_${this.idFactory.createObjId()}`;
[35443] Fix | Delete
if (this.parsingType3Font) {
[35444] Fix | Delete
id = `${this.idFactory.getDocId()}_type3_${id}`;
[35445] Fix | Delete
}
[35446] Fix | Delete
localShadingPatternCache.set(shading, id);
[35447] Fix | Delete
if (this.parsingType3Font) {
[35448] Fix | Delete
this.handler.send("commonobj", [id, "Pattern", patternIR]);
[35449] Fix | Delete
} else {
[35450] Fix | Delete
this.handler.send("obj", [id, this.pageIndex, "Pattern", patternIR]);
[35451] Fix | Delete
}
[35452] Fix | Delete
return id;
[35453] Fix | Delete
}
[35454] Fix | Delete
handleColorN(operatorList, fn, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache) {
[35455] Fix | Delete
const patternName = args.pop();
[35456] Fix | Delete
if (patternName instanceof Name) {
[35457] Fix | Delete
const rawPattern = patterns.getRaw(patternName.name);
[35458] Fix | Delete
const localTilingPattern = rawPattern instanceof Ref && localTilingPatternCache.getByRef(rawPattern);
[35459] Fix | Delete
if (localTilingPattern) {
[35460] Fix | Delete
try {
[35461] Fix | Delete
const color = cs.base ? cs.base.getRgb(args, 0) : null;
[35462] Fix | Delete
const tilingPatternIR = getTilingPatternIR(localTilingPattern.operatorListIR, localTilingPattern.dict, color);
[35463] Fix | Delete
operatorList.addOp(fn, tilingPatternIR);
[35464] Fix | Delete
return undefined;
[35465] Fix | Delete
} catch {}
[35466] Fix | Delete
}
[35467] Fix | Delete
const pattern = this.xref.fetchIfRef(rawPattern);
[35468] Fix | Delete
if (pattern) {
[35469] Fix | Delete
const dict = pattern instanceof BaseStream ? pattern.dict : pattern;
[35470] Fix | Delete
const typeNum = dict.get("PatternType");
[35471] Fix | Delete
if (typeNum === PatternType.TILING) {
[35472] Fix | Delete
const color = cs.base ? cs.base.getRgb(args, 0) : null;
[35473] Fix | Delete
return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task, localTilingPatternCache);
[35474] Fix | Delete
} else if (typeNum === PatternType.SHADING) {
[35475] Fix | Delete
const shading = dict.get("Shading");
[35476] Fix | Delete
const objId = this.parseShading({
[35477] Fix | Delete
shading,
[35478] Fix | Delete
resources,
[35479] Fix | Delete
localColorSpaceCache,
[35480] Fix | Delete
localShadingPatternCache
[35481] Fix | Delete
});
[35482] Fix | Delete
if (objId) {
[35483] Fix | Delete
const matrix = lookupMatrix(dict.getArray("Matrix"), null);
[35484] Fix | Delete
operatorList.addOp(fn, ["Shading", objId, matrix]);
[35485] Fix | Delete
}
[35486] Fix | Delete
return undefined;
[35487] Fix | Delete
}
[35488] Fix | Delete
throw new FormatError(`Unknown PatternType: ${typeNum}`);
[35489] Fix | Delete
}
[35490] Fix | Delete
}
[35491] Fix | Delete
throw new FormatError(`Unknown PatternName: ${patternName}`);
[35492] Fix | Delete
}
[35493] Fix | Delete
_parseVisibilityExpression(array, nestingCounter, currentResult) {
[35494] Fix | Delete
const MAX_NESTING = 10;
[35495] Fix | Delete
if (++nestingCounter > MAX_NESTING) {
[35496] Fix | Delete
warn("Visibility expression is too deeply nested");
[35497] Fix | Delete
return;
[35498] Fix | Delete
}
[35499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function