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
}
[34500] Fix | Delete
if (parsingArray) {
[34501] Fix | Delete
return null;
[34502] Fix | Delete
}
[34503] Fix | Delete
warn(`Unsupported blend mode: ${value.name}`);
[34504] Fix | Delete
return "source-over";
[34505] Fix | Delete
}
[34506] Fix | Delete
function incrementCachedImageMaskCount(data) {
[34507] Fix | Delete
if (data.fn === OPS.paintImageMaskXObject && data.args[0]?.count > 0) {
[34508] Fix | Delete
data.args[0].count++;
[34509] Fix | Delete
}
[34510] Fix | Delete
}
[34511] Fix | Delete
class TimeSlotManager {
[34512] Fix | Delete
static TIME_SLOT_DURATION_MS = 20;
[34513] Fix | Delete
static CHECK_TIME_EVERY = 100;
[34514] Fix | Delete
constructor() {
[34515] Fix | Delete
this.reset();
[34516] Fix | Delete
}
[34517] Fix | Delete
check() {
[34518] Fix | Delete
if (++this.checked < TimeSlotManager.CHECK_TIME_EVERY) {
[34519] Fix | Delete
return false;
[34520] Fix | Delete
}
[34521] Fix | Delete
this.checked = 0;
[34522] Fix | Delete
return this.endTime <= Date.now();
[34523] Fix | Delete
}
[34524] Fix | Delete
reset() {
[34525] Fix | Delete
this.endTime = Date.now() + TimeSlotManager.TIME_SLOT_DURATION_MS;
[34526] Fix | Delete
this.checked = 0;
[34527] Fix | Delete
}
[34528] Fix | Delete
}
[34529] Fix | Delete
class PartialEvaluator {
[34530] Fix | Delete
constructor({
[34531] Fix | Delete
xref,
[34532] Fix | Delete
handler,
[34533] Fix | Delete
pageIndex,
[34534] Fix | Delete
idFactory,
[34535] Fix | Delete
fontCache,
[34536] Fix | Delete
builtInCMapCache,
[34537] Fix | Delete
standardFontDataCache,
[34538] Fix | Delete
globalImageCache,
[34539] Fix | Delete
systemFontCache,
[34540] Fix | Delete
options = null
[34541] Fix | Delete
}) {
[34542] Fix | Delete
this.xref = xref;
[34543] Fix | Delete
this.handler = handler;
[34544] Fix | Delete
this.pageIndex = pageIndex;
[34545] Fix | Delete
this.idFactory = idFactory;
[34546] Fix | Delete
this.fontCache = fontCache;
[34547] Fix | Delete
this.builtInCMapCache = builtInCMapCache;
[34548] Fix | Delete
this.standardFontDataCache = standardFontDataCache;
[34549] Fix | Delete
this.globalImageCache = globalImageCache;
[34550] Fix | Delete
this.systemFontCache = systemFontCache;
[34551] Fix | Delete
this.options = options || DefaultPartialEvaluatorOptions;
[34552] Fix | Delete
this.type3FontRefs = null;
[34553] Fix | Delete
this._regionalImageCache = new RegionalImageCache();
[34554] Fix | Delete
this._fetchBuiltInCMapBound = this.fetchBuiltInCMap.bind(this);
[34555] Fix | Delete
ImageResizer.setMaxArea(this.options.canvasMaxAreaInBytes);
[34556] Fix | Delete
}
[34557] Fix | Delete
get _pdfFunctionFactory() {
[34558] Fix | Delete
const pdfFunctionFactory = new PDFFunctionFactory({
[34559] Fix | Delete
xref: this.xref,
[34560] Fix | Delete
isEvalSupported: this.options.isEvalSupported
[34561] Fix | Delete
});
[34562] Fix | Delete
return shadow(this, "_pdfFunctionFactory", pdfFunctionFactory);
[34563] Fix | Delete
}
[34564] Fix | Delete
get parsingType3Font() {
[34565] Fix | Delete
return !!this.type3FontRefs;
[34566] Fix | Delete
}
[34567] Fix | Delete
clone(newOptions = null) {
[34568] Fix | Delete
const newEvaluator = Object.create(this);
[34569] Fix | Delete
newEvaluator.options = Object.assign(Object.create(null), this.options, newOptions);
[34570] Fix | Delete
return newEvaluator;
[34571] Fix | Delete
}
[34572] Fix | Delete
hasBlendModes(resources, nonBlendModesSet) {
[34573] Fix | Delete
if (!(resources instanceof Dict)) {
[34574] Fix | Delete
return false;
[34575] Fix | Delete
}
[34576] Fix | Delete
if (resources.objId && nonBlendModesSet.has(resources.objId)) {
[34577] Fix | Delete
return false;
[34578] Fix | Delete
}
[34579] Fix | Delete
const processed = new RefSet(nonBlendModesSet);
[34580] Fix | Delete
if (resources.objId) {
[34581] Fix | Delete
processed.put(resources.objId);
[34582] Fix | Delete
}
[34583] Fix | Delete
const nodes = [resources],
[34584] Fix | Delete
xref = this.xref;
[34585] Fix | Delete
while (nodes.length) {
[34586] Fix | Delete
const node = nodes.shift();
[34587] Fix | Delete
const graphicStates = node.get("ExtGState");
[34588] Fix | Delete
if (graphicStates instanceof Dict) {
[34589] Fix | Delete
for (let graphicState of graphicStates.getRawValues()) {
[34590] Fix | Delete
if (graphicState instanceof Ref) {
[34591] Fix | Delete
if (processed.has(graphicState)) {
[34592] Fix | Delete
continue;
[34593] Fix | Delete
}
[34594] Fix | Delete
try {
[34595] Fix | Delete
graphicState = xref.fetch(graphicState);
[34596] Fix | Delete
} catch (ex) {
[34597] Fix | Delete
processed.put(graphicState);
[34598] Fix | Delete
info(`hasBlendModes - ignoring ExtGState: "${ex}".`);
[34599] Fix | Delete
continue;
[34600] Fix | Delete
}
[34601] Fix | Delete
}
[34602] Fix | Delete
if (!(graphicState instanceof Dict)) {
[34603] Fix | Delete
continue;
[34604] Fix | Delete
}
[34605] Fix | Delete
if (graphicState.objId) {
[34606] Fix | Delete
processed.put(graphicState.objId);
[34607] Fix | Delete
}
[34608] Fix | Delete
const bm = graphicState.get("BM");
[34609] Fix | Delete
if (bm instanceof Name) {
[34610] Fix | Delete
if (bm.name !== "Normal") {
[34611] Fix | Delete
return true;
[34612] Fix | Delete
}
[34613] Fix | Delete
continue;
[34614] Fix | Delete
}
[34615] Fix | Delete
if (bm !== undefined && Array.isArray(bm)) {
[34616] Fix | Delete
for (const element of bm) {
[34617] Fix | Delete
if (element instanceof Name && element.name !== "Normal") {
[34618] Fix | Delete
return true;
[34619] Fix | Delete
}
[34620] Fix | Delete
}
[34621] Fix | Delete
}
[34622] Fix | Delete
}
[34623] Fix | Delete
}
[34624] Fix | Delete
const xObjects = node.get("XObject");
[34625] Fix | Delete
if (!(xObjects instanceof Dict)) {
[34626] Fix | Delete
continue;
[34627] Fix | Delete
}
[34628] Fix | Delete
for (let xObject of xObjects.getRawValues()) {
[34629] Fix | Delete
if (xObject instanceof Ref) {
[34630] Fix | Delete
if (processed.has(xObject)) {
[34631] Fix | Delete
continue;
[34632] Fix | Delete
}
[34633] Fix | Delete
try {
[34634] Fix | Delete
xObject = xref.fetch(xObject);
[34635] Fix | Delete
} catch (ex) {
[34636] Fix | Delete
processed.put(xObject);
[34637] Fix | Delete
info(`hasBlendModes - ignoring XObject: "${ex}".`);
[34638] Fix | Delete
continue;
[34639] Fix | Delete
}
[34640] Fix | Delete
}
[34641] Fix | Delete
if (!(xObject instanceof BaseStream)) {
[34642] Fix | Delete
continue;
[34643] Fix | Delete
}
[34644] Fix | Delete
if (xObject.dict.objId) {
[34645] Fix | Delete
processed.put(xObject.dict.objId);
[34646] Fix | Delete
}
[34647] Fix | Delete
const xResources = xObject.dict.get("Resources");
[34648] Fix | Delete
if (!(xResources instanceof Dict)) {
[34649] Fix | Delete
continue;
[34650] Fix | Delete
}
[34651] Fix | Delete
if (xResources.objId && processed.has(xResources.objId)) {
[34652] Fix | Delete
continue;
[34653] Fix | Delete
}
[34654] Fix | Delete
nodes.push(xResources);
[34655] Fix | Delete
if (xResources.objId) {
[34656] Fix | Delete
processed.put(xResources.objId);
[34657] Fix | Delete
}
[34658] Fix | Delete
}
[34659] Fix | Delete
}
[34660] Fix | Delete
for (const ref of processed) {
[34661] Fix | Delete
nonBlendModesSet.put(ref);
[34662] Fix | Delete
}
[34663] Fix | Delete
return false;
[34664] Fix | Delete
}
[34665] Fix | Delete
async fetchBuiltInCMap(name) {
[34666] Fix | Delete
const cachedData = this.builtInCMapCache.get(name);
[34667] Fix | Delete
if (cachedData) {
[34668] Fix | Delete
return cachedData;
[34669] Fix | Delete
}
[34670] Fix | Delete
let data;
[34671] Fix | Delete
if (this.options.cMapUrl !== null) {
[34672] Fix | Delete
const url = `${this.options.cMapUrl}${name}.bcmap`;
[34673] Fix | Delete
const response = await fetch(url);
[34674] Fix | Delete
if (!response.ok) {
[34675] Fix | Delete
throw new Error(`fetchBuiltInCMap: failed to fetch file "${url}" with "${response.statusText}".`);
[34676] Fix | Delete
}
[34677] Fix | Delete
data = {
[34678] Fix | Delete
cMapData: new Uint8Array(await response.arrayBuffer()),
[34679] Fix | Delete
compressionType: CMapCompressionType.BINARY
[34680] Fix | Delete
};
[34681] Fix | Delete
} else {
[34682] Fix | Delete
data = await this.handler.sendWithPromise("FetchBuiltInCMap", {
[34683] Fix | Delete
name
[34684] Fix | Delete
});
[34685] Fix | Delete
}
[34686] Fix | Delete
if (data.compressionType !== CMapCompressionType.NONE) {
[34687] Fix | Delete
this.builtInCMapCache.set(name, data);
[34688] Fix | Delete
}
[34689] Fix | Delete
return data;
[34690] Fix | Delete
}
[34691] Fix | Delete
async fetchStandardFontData(name) {
[34692] Fix | Delete
const cachedData = this.standardFontDataCache.get(name);
[34693] Fix | Delete
if (cachedData) {
[34694] Fix | Delete
return new Stream(cachedData);
[34695] Fix | Delete
}
[34696] Fix | Delete
if (this.options.useSystemFonts && name !== "Symbol" && name !== "ZapfDingbats") {
[34697] Fix | Delete
return null;
[34698] Fix | Delete
}
[34699] Fix | Delete
const standardFontNameToFileName = getFontNameToFileMap(),
[34700] Fix | Delete
filename = standardFontNameToFileName[name];
[34701] Fix | Delete
let data;
[34702] Fix | Delete
if (this.options.standardFontDataUrl !== null) {
[34703] Fix | Delete
const url = `${this.options.standardFontDataUrl}${filename}`;
[34704] Fix | Delete
const response = await fetch(url);
[34705] Fix | Delete
if (!response.ok) {
[34706] Fix | Delete
warn(`fetchStandardFontData: failed to fetch file "${url}" with "${response.statusText}".`);
[34707] Fix | Delete
} else {
[34708] Fix | Delete
data = new Uint8Array(await response.arrayBuffer());
[34709] Fix | Delete
}
[34710] Fix | Delete
} else {
[34711] Fix | Delete
try {
[34712] Fix | Delete
data = await this.handler.sendWithPromise("FetchStandardFontData", {
[34713] Fix | Delete
filename
[34714] Fix | Delete
});
[34715] Fix | Delete
} catch (e) {
[34716] Fix | Delete
warn(`fetchStandardFontData: failed to fetch file "${filename}" with "${e}".`);
[34717] Fix | Delete
}
[34718] Fix | Delete
}
[34719] Fix | Delete
if (!data) {
[34720] Fix | Delete
return null;
[34721] Fix | Delete
}
[34722] Fix | Delete
this.standardFontDataCache.set(name, data);
[34723] Fix | Delete
return new Stream(data);
[34724] Fix | Delete
}
[34725] Fix | Delete
async buildFormXObject(resources, xobj, smask, operatorList, task, initialState, localColorSpaceCache) {
[34726] Fix | Delete
const dict = xobj.dict;
[34727] Fix | Delete
const matrix = lookupMatrix(dict.getArray("Matrix"), null);
[34728] Fix | Delete
const bbox = lookupNormalRect(dict.getArray("BBox"), null);
[34729] Fix | Delete
let optionalContent, groupOptions;
[34730] Fix | Delete
if (dict.has("OC")) {
[34731] Fix | Delete
optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
[34732] Fix | Delete
}
[34733] Fix | Delete
if (optionalContent !== undefined) {
[34734] Fix | Delete
operatorList.addOp(OPS.beginMarkedContentProps, ["OC", optionalContent]);
[34735] Fix | Delete
}
[34736] Fix | Delete
const group = dict.get("Group");
[34737] Fix | Delete
if (group) {
[34738] Fix | Delete
groupOptions = {
[34739] Fix | Delete
matrix,
[34740] Fix | Delete
bbox,
[34741] Fix | Delete
smask,
[34742] Fix | Delete
isolated: false,
[34743] Fix | Delete
knockout: false
[34744] Fix | Delete
};
[34745] Fix | Delete
const groupSubtype = group.get("S");
[34746] Fix | Delete
let colorSpace = null;
[34747] Fix | Delete
if (isName(groupSubtype, "Transparency")) {
[34748] Fix | Delete
groupOptions.isolated = group.get("I") || false;
[34749] Fix | Delete
groupOptions.knockout = group.get("K") || false;
[34750] Fix | Delete
if (group.has("CS")) {
[34751] Fix | Delete
const cs = group.getRaw("CS");
[34752] Fix | Delete
const cachedColorSpace = ColorSpace.getCached(cs, this.xref, localColorSpaceCache);
[34753] Fix | Delete
if (cachedColorSpace) {
[34754] Fix | Delete
colorSpace = cachedColorSpace;
[34755] Fix | Delete
} else {
[34756] Fix | Delete
colorSpace = await this.parseColorSpace({
[34757] Fix | Delete
cs,
[34758] Fix | Delete
resources,
[34759] Fix | Delete
localColorSpaceCache
[34760] Fix | Delete
});
[34761] Fix | Delete
}
[34762] Fix | Delete
}
[34763] Fix | Delete
}
[34764] Fix | Delete
if (smask?.backdrop) {
[34765] Fix | Delete
colorSpace ||= ColorSpace.singletons.rgb;
[34766] Fix | Delete
smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
[34767] Fix | Delete
}
[34768] Fix | Delete
operatorList.addOp(OPS.beginGroup, [groupOptions]);
[34769] Fix | Delete
}
[34770] Fix | Delete
const args = group ? [matrix, null] : [matrix, bbox];
[34771] Fix | Delete
operatorList.addOp(OPS.paintFormXObjectBegin, args);
[34772] Fix | Delete
await this.getOperatorList({
[34773] Fix | Delete
stream: xobj,
[34774] Fix | Delete
task,
[34775] Fix | Delete
resources: dict.get("Resources") || resources,
[34776] Fix | Delete
operatorList,
[34777] Fix | Delete
initialState
[34778] Fix | Delete
});
[34779] Fix | Delete
operatorList.addOp(OPS.paintFormXObjectEnd, []);
[34780] Fix | Delete
if (group) {
[34781] Fix | Delete
operatorList.addOp(OPS.endGroup, [groupOptions]);
[34782] Fix | Delete
}
[34783] Fix | Delete
if (optionalContent !== undefined) {
[34784] Fix | Delete
operatorList.addOp(OPS.endMarkedContent, []);
[34785] Fix | Delete
}
[34786] Fix | Delete
}
[34787] Fix | Delete
_sendImgData(objId, imgData, cacheGlobally = false) {
[34788] Fix | Delete
const transfers = imgData ? [imgData.bitmap || imgData.data.buffer] : null;
[34789] Fix | Delete
if (this.parsingType3Font || cacheGlobally) {
[34790] Fix | Delete
return this.handler.send("commonobj", [objId, "Image", imgData], transfers);
[34791] Fix | Delete
}
[34792] Fix | Delete
return this.handler.send("obj", [objId, this.pageIndex, "Image", imgData], transfers);
[34793] Fix | Delete
}
[34794] Fix | Delete
async buildPaintImageXObject({
[34795] Fix | Delete
resources,
[34796] Fix | Delete
image,
[34797] Fix | Delete
isInline = false,
[34798] Fix | Delete
operatorList,
[34799] Fix | Delete
cacheKey,
[34800] Fix | Delete
localImageCache,
[34801] Fix | Delete
localColorSpaceCache
[34802] Fix | Delete
}) {
[34803] Fix | Delete
const dict = image.dict;
[34804] Fix | Delete
const imageRef = dict.objId;
[34805] Fix | Delete
const w = dict.get("W", "Width");
[34806] Fix | Delete
const h = dict.get("H", "Height");
[34807] Fix | Delete
if (!(w && typeof w === "number") || !(h && typeof h === "number")) {
[34808] Fix | Delete
warn("Image dimensions are missing, or not numbers.");
[34809] Fix | Delete
return;
[34810] Fix | Delete
}
[34811] Fix | Delete
const maxImageSize = this.options.maxImageSize;
[34812] Fix | Delete
if (maxImageSize !== -1 && w * h > maxImageSize) {
[34813] Fix | Delete
const msg = "Image exceeded maximum allowed size and was removed.";
[34814] Fix | Delete
if (this.options.ignoreErrors) {
[34815] Fix | Delete
warn(msg);
[34816] Fix | Delete
return;
[34817] Fix | Delete
}
[34818] Fix | Delete
throw new Error(msg);
[34819] Fix | Delete
}
[34820] Fix | Delete
let optionalContent;
[34821] Fix | Delete
if (dict.has("OC")) {
[34822] Fix | Delete
optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
[34823] Fix | Delete
}
[34824] Fix | Delete
const imageMask = dict.get("IM", "ImageMask") || false;
[34825] Fix | Delete
let imgData, args;
[34826] Fix | Delete
if (imageMask) {
[34827] Fix | Delete
const interpolate = dict.get("I", "Interpolate");
[34828] Fix | Delete
const bitStrideLength = w + 7 >> 3;
[34829] Fix | Delete
const imgArray = image.getBytes(bitStrideLength * h);
[34830] Fix | Delete
const decode = dict.getArray("D", "Decode");
[34831] Fix | Delete
if (this.parsingType3Font) {
[34832] Fix | Delete
imgData = PDFImage.createRawMask({
[34833] Fix | Delete
imgArray,
[34834] Fix | Delete
width: w,
[34835] Fix | Delete
height: h,
[34836] Fix | Delete
imageIsFromDecodeStream: image instanceof DecodeStream,
[34837] Fix | Delete
inverseDecode: decode?.[0] > 0,
[34838] Fix | Delete
interpolate
[34839] Fix | Delete
});
[34840] Fix | Delete
imgData.cached = !!cacheKey;
[34841] Fix | Delete
args = [imgData];
[34842] Fix | Delete
operatorList.addImageOps(OPS.paintImageMaskXObject, args, optionalContent);
[34843] Fix | Delete
if (cacheKey) {
[34844] Fix | Delete
const cacheData = {
[34845] Fix | Delete
fn: OPS.paintImageMaskXObject,
[34846] Fix | Delete
args,
[34847] Fix | Delete
optionalContent
[34848] Fix | Delete
};
[34849] Fix | Delete
localImageCache.set(cacheKey, imageRef, cacheData);
[34850] Fix | Delete
if (imageRef) {
[34851] Fix | Delete
this._regionalImageCache.set(null, imageRef, cacheData);
[34852] Fix | Delete
}
[34853] Fix | Delete
}
[34854] Fix | Delete
return;
[34855] Fix | Delete
}
[34856] Fix | Delete
imgData = await PDFImage.createMask({
[34857] Fix | Delete
imgArray,
[34858] Fix | Delete
width: w,
[34859] Fix | Delete
height: h,
[34860] Fix | Delete
imageIsFromDecodeStream: image instanceof DecodeStream,
[34861] Fix | Delete
inverseDecode: decode?.[0] > 0,
[34862] Fix | Delete
interpolate,
[34863] Fix | Delete
isOffscreenCanvasSupported: this.options.isOffscreenCanvasSupported
[34864] Fix | Delete
});
[34865] Fix | Delete
if (imgData.isSingleOpaquePixel) {
[34866] Fix | Delete
operatorList.addImageOps(OPS.paintSolidColorImageMask, [], optionalContent);
[34867] Fix | Delete
if (cacheKey) {
[34868] Fix | Delete
const cacheData = {
[34869] Fix | Delete
fn: OPS.paintSolidColorImageMask,
[34870] Fix | Delete
args: [],
[34871] Fix | Delete
optionalContent
[34872] Fix | Delete
};
[34873] Fix | Delete
localImageCache.set(cacheKey, imageRef, cacheData);
[34874] Fix | Delete
if (imageRef) {
[34875] Fix | Delete
this._regionalImageCache.set(null, imageRef, cacheData);
[34876] Fix | Delete
}
[34877] Fix | Delete
}
[34878] Fix | Delete
return;
[34879] Fix | Delete
}
[34880] Fix | Delete
const objId = `mask_${this.idFactory.createObjId()}`;
[34881] Fix | Delete
operatorList.addDependency(objId);
[34882] Fix | Delete
imgData.dataLen = imgData.bitmap ? imgData.width * imgData.height * 4 : imgData.data.length;
[34883] Fix | Delete
this._sendImgData(objId, imgData);
[34884] Fix | Delete
args = [{
[34885] Fix | Delete
data: objId,
[34886] Fix | Delete
width: imgData.width,
[34887] Fix | Delete
height: imgData.height,
[34888] Fix | Delete
interpolate: imgData.interpolate,
[34889] Fix | Delete
count: 1
[34890] Fix | Delete
}];
[34891] Fix | Delete
operatorList.addImageOps(OPS.paintImageMaskXObject, args, optionalContent);
[34892] Fix | Delete
if (cacheKey) {
[34893] Fix | Delete
const cacheData = {
[34894] Fix | Delete
fn: OPS.paintImageMaskXObject,
[34895] Fix | Delete
args,
[34896] Fix | Delete
optionalContent
[34897] Fix | Delete
};
[34898] Fix | Delete
localImageCache.set(cacheKey, imageRef, cacheData);
[34899] Fix | Delete
if (imageRef) {
[34900] Fix | Delete
this._regionalImageCache.set(null, imageRef, cacheData);
[34901] Fix | Delete
}
[34902] Fix | Delete
}
[34903] Fix | Delete
return;
[34904] Fix | Delete
}
[34905] Fix | Delete
const SMALL_IMAGE_DIMENSIONS = 200;
[34906] Fix | Delete
if (isInline && w + h < SMALL_IMAGE_DIMENSIONS && !dict.has("SMask") && !dict.has("Mask")) {
[34907] Fix | Delete
try {
[34908] Fix | Delete
const imageObj = new PDFImage({
[34909] Fix | Delete
xref: this.xref,
[34910] Fix | Delete
res: resources,
[34911] Fix | Delete
image,
[34912] Fix | Delete
isInline,
[34913] Fix | Delete
pdfFunctionFactory: this._pdfFunctionFactory,
[34914] Fix | Delete
localColorSpaceCache
[34915] Fix | Delete
});
[34916] Fix | Delete
imgData = await imageObj.createImageData(true, false);
[34917] Fix | Delete
operatorList.isOffscreenCanvasSupported = this.options.isOffscreenCanvasSupported;
[34918] Fix | Delete
operatorList.addImageOps(OPS.paintInlineImageXObject, [imgData], optionalContent);
[34919] Fix | Delete
} catch (reason) {
[34920] Fix | Delete
const msg = `Unable to decode inline image: "${reason}".`;
[34921] Fix | Delete
if (!this.options.ignoreErrors) {
[34922] Fix | Delete
throw new Error(msg);
[34923] Fix | Delete
}
[34924] Fix | Delete
warn(msg);
[34925] Fix | Delete
}
[34926] Fix | Delete
return;
[34927] Fix | Delete
}
[34928] Fix | Delete
let objId = `img_${this.idFactory.createObjId()}`,
[34929] Fix | Delete
cacheGlobally = false;
[34930] Fix | Delete
if (this.parsingType3Font) {
[34931] Fix | Delete
objId = `${this.idFactory.getDocId()}_type3_${objId}`;
[34932] Fix | Delete
} else if (cacheKey && imageRef) {
[34933] Fix | Delete
cacheGlobally = this.globalImageCache.shouldCache(imageRef, this.pageIndex);
[34934] Fix | Delete
if (cacheGlobally) {
[34935] Fix | Delete
assert(!isInline, "Cannot cache an inline image globally.");
[34936] Fix | Delete
objId = `${this.idFactory.getDocId()}_${objId}`;
[34937] Fix | Delete
}
[34938] Fix | Delete
}
[34939] Fix | Delete
operatorList.addDependency(objId);
[34940] Fix | Delete
args = [objId, w, h];
[34941] Fix | Delete
operatorList.addImageOps(OPS.paintImageXObject, args, optionalContent);
[34942] Fix | Delete
if (cacheGlobally) {
[34943] Fix | Delete
if (this.globalImageCache.hasDecodeFailed(imageRef)) {
[34944] Fix | Delete
this.globalImageCache.setData(imageRef, {
[34945] Fix | Delete
objId,
[34946] Fix | Delete
fn: OPS.paintImageXObject,
[34947] Fix | Delete
args,
[34948] Fix | Delete
optionalContent,
[34949] Fix | Delete
byteSize: 0
[34950] Fix | Delete
});
[34951] Fix | Delete
this._sendImgData(objId, null, cacheGlobally);
[34952] Fix | Delete
return;
[34953] Fix | Delete
}
[34954] Fix | Delete
if (w * h > 250000 || dict.has("SMask") || dict.has("Mask")) {
[34955] Fix | Delete
const localLength = await this.handler.sendWithPromise("commonobj", [objId, "CopyLocalImage", {
[34956] Fix | Delete
imageRef
[34957] Fix | Delete
}]);
[34958] Fix | Delete
if (localLength) {
[34959] Fix | Delete
this.globalImageCache.setData(imageRef, {
[34960] Fix | Delete
objId,
[34961] Fix | Delete
fn: OPS.paintImageXObject,
[34962] Fix | Delete
args,
[34963] Fix | Delete
optionalContent,
[34964] Fix | Delete
byteSize: 0
[34965] Fix | Delete
});
[34966] Fix | Delete
this.globalImageCache.addByteSize(imageRef, localLength);
[34967] Fix | Delete
return;
[34968] Fix | Delete
}
[34969] Fix | Delete
}
[34970] Fix | Delete
}
[34971] Fix | Delete
PDFImage.buildImage({
[34972] Fix | Delete
xref: this.xref,
[34973] Fix | Delete
res: resources,
[34974] Fix | Delete
image,
[34975] Fix | Delete
isInline,
[34976] Fix | Delete
pdfFunctionFactory: this._pdfFunctionFactory,
[34977] Fix | Delete
localColorSpaceCache
[34978] Fix | Delete
}).then(async imageObj => {
[34979] Fix | Delete
imgData = await imageObj.createImageData(false, this.options.isOffscreenCanvasSupported);
[34980] Fix | Delete
imgData.dataLen = imgData.bitmap ? imgData.width * imgData.height * 4 : imgData.data.length;
[34981] Fix | Delete
imgData.ref = imageRef;
[34982] Fix | Delete
if (cacheGlobally) {
[34983] Fix | Delete
this.globalImageCache.addByteSize(imageRef, imgData.dataLen);
[34984] Fix | Delete
}
[34985] Fix | Delete
return this._sendImgData(objId, imgData, cacheGlobally);
[34986] Fix | Delete
}).catch(reason => {
[34987] Fix | Delete
warn(`Unable to decode image "${objId}": "${reason}".`);
[34988] Fix | Delete
if (imageRef) {
[34989] Fix | Delete
this.globalImageCache.addDecodeFailed(imageRef);
[34990] Fix | Delete
}
[34991] Fix | Delete
return this._sendImgData(objId, null, cacheGlobally);
[34992] Fix | Delete
});
[34993] Fix | Delete
if (cacheKey) {
[34994] Fix | Delete
const cacheData = {
[34995] Fix | Delete
fn: OPS.paintImageXObject,
[34996] Fix | Delete
args,
[34997] Fix | Delete
optionalContent
[34998] Fix | Delete
};
[34999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function