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
if (!isOffscreenCanvasSupported) {
[54500] Fix | Delete
break;
[54501] Fix | Delete
}
[54502] Fix | Delete
const image = await imagePromises.get(annotation.bitmapId);
[54503] Fix | Delete
if (image.imageStream) {
[54504] Fix | Delete
const {
[54505] Fix | Delete
imageStream,
[54506] Fix | Delete
smaskStream
[54507] Fix | Delete
} = image;
[54508] Fix | Delete
const buffer = [];
[54509] Fix | Delete
if (smaskStream) {
[54510] Fix | Delete
const smaskRef = xref.getNewTemporaryRef();
[54511] Fix | Delete
await writeObject(smaskRef, smaskStream, buffer, xref);
[54512] Fix | Delete
dependencies.push({
[54513] Fix | Delete
ref: smaskRef,
[54514] Fix | Delete
data: buffer.join("")
[54515] Fix | Delete
});
[54516] Fix | Delete
imageStream.dict.set("SMask", smaskRef);
[54517] Fix | Delete
buffer.length = 0;
[54518] Fix | Delete
}
[54519] Fix | Delete
const imageRef = image.imageRef = xref.getNewTemporaryRef();
[54520] Fix | Delete
await writeObject(imageRef, imageStream, buffer, xref);
[54521] Fix | Delete
dependencies.push({
[54522] Fix | Delete
ref: imageRef,
[54523] Fix | Delete
data: buffer.join("")
[54524] Fix | Delete
});
[54525] Fix | Delete
image.imageStream = image.smaskStream = null;
[54526] Fix | Delete
}
[54527] Fix | Delete
promises.push(StampAnnotation.createNewAnnotation(xref, annotation, dependencies, {
[54528] Fix | Delete
image
[54529] Fix | Delete
}));
[54530] Fix | Delete
break;
[54531] Fix | Delete
}
[54532] Fix | Delete
}
[54533] Fix | Delete
return {
[54534] Fix | Delete
annotations: await Promise.all(promises),
[54535] Fix | Delete
dependencies
[54536] Fix | Delete
};
[54537] Fix | Delete
}
[54538] Fix | Delete
static async printNewAnnotations(annotationGlobals, evaluator, task, annotations, imagePromises) {
[54539] Fix | Delete
if (!annotations) {
[54540] Fix | Delete
return null;
[54541] Fix | Delete
}
[54542] Fix | Delete
const {
[54543] Fix | Delete
options,
[54544] Fix | Delete
xref
[54545] Fix | Delete
} = evaluator;
[54546] Fix | Delete
const promises = [];
[54547] Fix | Delete
for (const annotation of annotations) {
[54548] Fix | Delete
if (annotation.deleted) {
[54549] Fix | Delete
continue;
[54550] Fix | Delete
}
[54551] Fix | Delete
switch (annotation.annotationType) {
[54552] Fix | Delete
case AnnotationEditorType.FREETEXT:
[54553] Fix | Delete
promises.push(FreeTextAnnotation.createNewPrintAnnotation(annotationGlobals, xref, annotation, {
[54554] Fix | Delete
evaluator,
[54555] Fix | Delete
task,
[54556] Fix | Delete
evaluatorOptions: options
[54557] Fix | Delete
}));
[54558] Fix | Delete
break;
[54559] Fix | Delete
case AnnotationEditorType.HIGHLIGHT:
[54560] Fix | Delete
if (annotation.quadPoints) {
[54561] Fix | Delete
promises.push(HighlightAnnotation.createNewPrintAnnotation(annotationGlobals, xref, annotation, {
[54562] Fix | Delete
evaluatorOptions: options
[54563] Fix | Delete
}));
[54564] Fix | Delete
} else {
[54565] Fix | Delete
promises.push(InkAnnotation.createNewPrintAnnotation(annotationGlobals, xref, annotation, {
[54566] Fix | Delete
evaluatorOptions: options
[54567] Fix | Delete
}));
[54568] Fix | Delete
}
[54569] Fix | Delete
break;
[54570] Fix | Delete
case AnnotationEditorType.INK:
[54571] Fix | Delete
promises.push(InkAnnotation.createNewPrintAnnotation(annotationGlobals, xref, annotation, {
[54572] Fix | Delete
evaluatorOptions: options
[54573] Fix | Delete
}));
[54574] Fix | Delete
break;
[54575] Fix | Delete
case AnnotationEditorType.STAMP:
[54576] Fix | Delete
if (!options.isOffscreenCanvasSupported) {
[54577] Fix | Delete
break;
[54578] Fix | Delete
}
[54579] Fix | Delete
const image = await imagePromises.get(annotation.bitmapId);
[54580] Fix | Delete
if (image.imageStream) {
[54581] Fix | Delete
const {
[54582] Fix | Delete
imageStream,
[54583] Fix | Delete
smaskStream
[54584] Fix | Delete
} = image;
[54585] Fix | Delete
if (smaskStream) {
[54586] Fix | Delete
imageStream.dict.set("SMask", smaskStream);
[54587] Fix | Delete
}
[54588] Fix | Delete
image.imageRef = new JpegStream(imageStream, imageStream.length);
[54589] Fix | Delete
image.imageStream = image.smaskStream = null;
[54590] Fix | Delete
}
[54591] Fix | Delete
promises.push(StampAnnotation.createNewPrintAnnotation(annotationGlobals, xref, annotation, {
[54592] Fix | Delete
image,
[54593] Fix | Delete
evaluatorOptions: options
[54594] Fix | Delete
}));
[54595] Fix | Delete
break;
[54596] Fix | Delete
}
[54597] Fix | Delete
}
[54598] Fix | Delete
return Promise.all(promises);
[54599] Fix | Delete
}
[54600] Fix | Delete
}
[54601] Fix | Delete
function getRgbColor(color, defaultColor = new Uint8ClampedArray(3)) {
[54602] Fix | Delete
if (!Array.isArray(color)) {
[54603] Fix | Delete
return defaultColor;
[54604] Fix | Delete
}
[54605] Fix | Delete
const rgbColor = defaultColor || new Uint8ClampedArray(3);
[54606] Fix | Delete
switch (color.length) {
[54607] Fix | Delete
case 0:
[54608] Fix | Delete
return null;
[54609] Fix | Delete
case 1:
[54610] Fix | Delete
ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
[54611] Fix | Delete
return rgbColor;
[54612] Fix | Delete
case 3:
[54613] Fix | Delete
ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
[54614] Fix | Delete
return rgbColor;
[54615] Fix | Delete
case 4:
[54616] Fix | Delete
ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
[54617] Fix | Delete
return rgbColor;
[54618] Fix | Delete
default:
[54619] Fix | Delete
return defaultColor;
[54620] Fix | Delete
}
[54621] Fix | Delete
}
[54622] Fix | Delete
function getPdfColorArray(color) {
[54623] Fix | Delete
return Array.from(color, c => c / 255);
[54624] Fix | Delete
}
[54625] Fix | Delete
function getQuadPoints(dict, rect) {
[54626] Fix | Delete
const quadPoints = dict.getArray("QuadPoints");
[54627] Fix | Delete
if (!isNumberArray(quadPoints, null) || quadPoints.length === 0 || quadPoints.length % 8 > 0) {
[54628] Fix | Delete
return null;
[54629] Fix | Delete
}
[54630] Fix | Delete
const quadPointsLists = [];
[54631] Fix | Delete
for (let i = 0, ii = quadPoints.length / 8; i < ii; i++) {
[54632] Fix | Delete
let minX = Infinity,
[54633] Fix | Delete
maxX = -Infinity,
[54634] Fix | Delete
minY = Infinity,
[54635] Fix | Delete
maxY = -Infinity;
[54636] Fix | Delete
for (let j = i * 8, jj = i * 8 + 8; j < jj; j += 2) {
[54637] Fix | Delete
const x = quadPoints[j];
[54638] Fix | Delete
const y = quadPoints[j + 1];
[54639] Fix | Delete
minX = Math.min(x, minX);
[54640] Fix | Delete
maxX = Math.max(x, maxX);
[54641] Fix | Delete
minY = Math.min(y, minY);
[54642] Fix | Delete
maxY = Math.max(y, maxY);
[54643] Fix | Delete
}
[54644] Fix | Delete
if (rect !== null && (minX < rect[0] || maxX > rect[2] || minY < rect[1] || maxY > rect[3])) {
[54645] Fix | Delete
return null;
[54646] Fix | Delete
}
[54647] Fix | Delete
quadPointsLists.push([{
[54648] Fix | Delete
x: minX,
[54649] Fix | Delete
y: maxY
[54650] Fix | Delete
}, {
[54651] Fix | Delete
x: maxX,
[54652] Fix | Delete
y: maxY
[54653] Fix | Delete
}, {
[54654] Fix | Delete
x: minX,
[54655] Fix | Delete
y: minY
[54656] Fix | Delete
}, {
[54657] Fix | Delete
x: maxX,
[54658] Fix | Delete
y: minY
[54659] Fix | Delete
}]);
[54660] Fix | Delete
}
[54661] Fix | Delete
return quadPointsLists;
[54662] Fix | Delete
}
[54663] Fix | Delete
function getTransformMatrix(rect, bbox, matrix) {
[54664] Fix | Delete
const [minX, minY, maxX, maxY] = Util.getAxialAlignedBoundingBox(bbox, matrix);
[54665] Fix | Delete
if (minX === maxX || minY === maxY) {
[54666] Fix | Delete
return [1, 0, 0, 1, rect[0], rect[1]];
[54667] Fix | Delete
}
[54668] Fix | Delete
const xRatio = (rect[2] - rect[0]) / (maxX - minX);
[54669] Fix | Delete
const yRatio = (rect[3] - rect[1]) / (maxY - minY);
[54670] Fix | Delete
return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio];
[54671] Fix | Delete
}
[54672] Fix | Delete
class Annotation {
[54673] Fix | Delete
constructor(params) {
[54674] Fix | Delete
const {
[54675] Fix | Delete
dict,
[54676] Fix | Delete
xref,
[54677] Fix | Delete
annotationGlobals
[54678] Fix | Delete
} = params;
[54679] Fix | Delete
this.setTitle(dict.get("T"));
[54680] Fix | Delete
this.setContents(dict.get("Contents"));
[54681] Fix | Delete
this.setModificationDate(dict.get("M"));
[54682] Fix | Delete
this.setFlags(dict.get("F"));
[54683] Fix | Delete
this.setRectangle(dict.getArray("Rect"));
[54684] Fix | Delete
this.setColor(dict.getArray("C"));
[54685] Fix | Delete
this.setBorderStyle(dict);
[54686] Fix | Delete
this.setAppearance(dict);
[54687] Fix | Delete
this.setOptionalContent(dict);
[54688] Fix | Delete
const MK = dict.get("MK");
[54689] Fix | Delete
this.setBorderAndBackgroundColors(MK);
[54690] Fix | Delete
this.setRotation(MK, dict);
[54691] Fix | Delete
this.ref = params.ref instanceof Ref ? params.ref : null;
[54692] Fix | Delete
this._streams = [];
[54693] Fix | Delete
if (this.appearance) {
[54694] Fix | Delete
this._streams.push(this.appearance);
[54695] Fix | Delete
}
[54696] Fix | Delete
const isLocked = !!(this.flags & AnnotationFlag.LOCKED);
[54697] Fix | Delete
const isContentLocked = !!(this.flags & AnnotationFlag.LOCKEDCONTENTS);
[54698] Fix | Delete
if (annotationGlobals.structTreeRoot) {
[54699] Fix | Delete
let structParent = dict.get("StructParent");
[54700] Fix | Delete
structParent = Number.isInteger(structParent) && structParent >= 0 ? structParent : -1;
[54701] Fix | Delete
annotationGlobals.structTreeRoot.addAnnotationIdToPage(params.pageRef, structParent);
[54702] Fix | Delete
}
[54703] Fix | Delete
this.data = {
[54704] Fix | Delete
annotationFlags: this.flags,
[54705] Fix | Delete
borderStyle: this.borderStyle,
[54706] Fix | Delete
color: this.color,
[54707] Fix | Delete
backgroundColor: this.backgroundColor,
[54708] Fix | Delete
borderColor: this.borderColor,
[54709] Fix | Delete
rotation: this.rotation,
[54710] Fix | Delete
contentsObj: this._contents,
[54711] Fix | Delete
hasAppearance: !!this.appearance,
[54712] Fix | Delete
id: params.id,
[54713] Fix | Delete
modificationDate: this.modificationDate,
[54714] Fix | Delete
rect: this.rectangle,
[54715] Fix | Delete
subtype: params.subtype,
[54716] Fix | Delete
hasOwnCanvas: false,
[54717] Fix | Delete
noRotate: !!(this.flags & AnnotationFlag.NOROTATE),
[54718] Fix | Delete
noHTML: isLocked && isContentLocked
[54719] Fix | Delete
};
[54720] Fix | Delete
if (params.collectFields) {
[54721] Fix | Delete
const kids = dict.get("Kids");
[54722] Fix | Delete
if (Array.isArray(kids)) {
[54723] Fix | Delete
const kidIds = [];
[54724] Fix | Delete
for (const kid of kids) {
[54725] Fix | Delete
if (kid instanceof Ref) {
[54726] Fix | Delete
kidIds.push(kid.toString());
[54727] Fix | Delete
}
[54728] Fix | Delete
}
[54729] Fix | Delete
if (kidIds.length !== 0) {
[54730] Fix | Delete
this.data.kidIds = kidIds;
[54731] Fix | Delete
}
[54732] Fix | Delete
}
[54733] Fix | Delete
this.data.actions = collectActions(xref, dict, AnnotationActionEventType);
[54734] Fix | Delete
this.data.fieldName = this._constructFieldName(dict);
[54735] Fix | Delete
this.data.pageIndex = params.pageIndex;
[54736] Fix | Delete
}
[54737] Fix | Delete
this._isOffscreenCanvasSupported = params.evaluatorOptions.isOffscreenCanvasSupported;
[54738] Fix | Delete
this._fallbackFontDict = null;
[54739] Fix | Delete
this._needAppearances = false;
[54740] Fix | Delete
}
[54741] Fix | Delete
_hasFlag(flags, flag) {
[54742] Fix | Delete
return !!(flags & flag);
[54743] Fix | Delete
}
[54744] Fix | Delete
_isViewable(flags) {
[54745] Fix | Delete
return !this._hasFlag(flags, AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, AnnotationFlag.NOVIEW);
[54746] Fix | Delete
}
[54747] Fix | Delete
_isPrintable(flags) {
[54748] Fix | Delete
return this._hasFlag(flags, AnnotationFlag.PRINT) && !this._hasFlag(flags, AnnotationFlag.HIDDEN) && !this._hasFlag(flags, AnnotationFlag.INVISIBLE);
[54749] Fix | Delete
}
[54750] Fix | Delete
mustBeViewed(annotationStorage, _renderForms) {
[54751] Fix | Delete
const noView = annotationStorage?.get(this.data.id)?.noView;
[54752] Fix | Delete
if (noView !== undefined) {
[54753] Fix | Delete
return !noView;
[54754] Fix | Delete
}
[54755] Fix | Delete
return this.viewable && !this._hasFlag(this.flags, AnnotationFlag.HIDDEN);
[54756] Fix | Delete
}
[54757] Fix | Delete
mustBePrinted(annotationStorage) {
[54758] Fix | Delete
const noPrint = annotationStorage?.get(this.data.id)?.noPrint;
[54759] Fix | Delete
if (noPrint !== undefined) {
[54760] Fix | Delete
return !noPrint;
[54761] Fix | Delete
}
[54762] Fix | Delete
return this.printable;
[54763] Fix | Delete
}
[54764] Fix | Delete
get viewable() {
[54765] Fix | Delete
if (this.data.quadPoints === null) {
[54766] Fix | Delete
return false;
[54767] Fix | Delete
}
[54768] Fix | Delete
if (this.flags === 0) {
[54769] Fix | Delete
return true;
[54770] Fix | Delete
}
[54771] Fix | Delete
return this._isViewable(this.flags);
[54772] Fix | Delete
}
[54773] Fix | Delete
get printable() {
[54774] Fix | Delete
if (this.data.quadPoints === null) {
[54775] Fix | Delete
return false;
[54776] Fix | Delete
}
[54777] Fix | Delete
if (this.flags === 0) {
[54778] Fix | Delete
return false;
[54779] Fix | Delete
}
[54780] Fix | Delete
return this._isPrintable(this.flags);
[54781] Fix | Delete
}
[54782] Fix | Delete
_parseStringHelper(data) {
[54783] Fix | Delete
const str = typeof data === "string" ? stringToPDFString(data) : "";
[54784] Fix | Delete
const dir = str && bidi(str).dir === "rtl" ? "rtl" : "ltr";
[54785] Fix | Delete
return {
[54786] Fix | Delete
str,
[54787] Fix | Delete
dir
[54788] Fix | Delete
};
[54789] Fix | Delete
}
[54790] Fix | Delete
setDefaultAppearance(params) {
[54791] Fix | Delete
const {
[54792] Fix | Delete
dict,
[54793] Fix | Delete
annotationGlobals
[54794] Fix | Delete
} = params;
[54795] Fix | Delete
const defaultAppearance = getInheritableProperty({
[54796] Fix | Delete
dict,
[54797] Fix | Delete
key: "DA"
[54798] Fix | Delete
}) || annotationGlobals.acroForm.get("DA");
[54799] Fix | Delete
this._defaultAppearance = typeof defaultAppearance === "string" ? defaultAppearance : "";
[54800] Fix | Delete
this.data.defaultAppearanceData = parseDefaultAppearance(this._defaultAppearance);
[54801] Fix | Delete
}
[54802] Fix | Delete
setTitle(title) {
[54803] Fix | Delete
this._title = this._parseStringHelper(title);
[54804] Fix | Delete
}
[54805] Fix | Delete
setContents(contents) {
[54806] Fix | Delete
this._contents = this._parseStringHelper(contents);
[54807] Fix | Delete
}
[54808] Fix | Delete
setModificationDate(modificationDate) {
[54809] Fix | Delete
this.modificationDate = typeof modificationDate === "string" ? modificationDate : null;
[54810] Fix | Delete
}
[54811] Fix | Delete
setFlags(flags) {
[54812] Fix | Delete
this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0;
[54813] Fix | Delete
if (this.flags & AnnotationFlag.INVISIBLE && this.constructor.name !== "Annotation") {
[54814] Fix | Delete
this.flags ^= AnnotationFlag.INVISIBLE;
[54815] Fix | Delete
}
[54816] Fix | Delete
}
[54817] Fix | Delete
hasFlag(flag) {
[54818] Fix | Delete
return this._hasFlag(this.flags, flag);
[54819] Fix | Delete
}
[54820] Fix | Delete
setRectangle(rectangle) {
[54821] Fix | Delete
this.rectangle = lookupNormalRect(rectangle, [0, 0, 0, 0]);
[54822] Fix | Delete
}
[54823] Fix | Delete
setColor(color) {
[54824] Fix | Delete
this.color = getRgbColor(color);
[54825] Fix | Delete
}
[54826] Fix | Delete
setLineEndings(lineEndings) {
[54827] Fix | Delete
this.lineEndings = ["None", "None"];
[54828] Fix | Delete
if (Array.isArray(lineEndings) && lineEndings.length === 2) {
[54829] Fix | Delete
for (let i = 0; i < 2; i++) {
[54830] Fix | Delete
const obj = lineEndings[i];
[54831] Fix | Delete
if (obj instanceof Name) {
[54832] Fix | Delete
switch (obj.name) {
[54833] Fix | Delete
case "None":
[54834] Fix | Delete
continue;
[54835] Fix | Delete
case "Square":
[54836] Fix | Delete
case "Circle":
[54837] Fix | Delete
case "Diamond":
[54838] Fix | Delete
case "OpenArrow":
[54839] Fix | Delete
case "ClosedArrow":
[54840] Fix | Delete
case "Butt":
[54841] Fix | Delete
case "ROpenArrow":
[54842] Fix | Delete
case "RClosedArrow":
[54843] Fix | Delete
case "Slash":
[54844] Fix | Delete
this.lineEndings[i] = obj.name;
[54845] Fix | Delete
continue;
[54846] Fix | Delete
}
[54847] Fix | Delete
}
[54848] Fix | Delete
warn(`Ignoring invalid lineEnding: ${obj}`);
[54849] Fix | Delete
}
[54850] Fix | Delete
}
[54851] Fix | Delete
}
[54852] Fix | Delete
setRotation(mk, dict) {
[54853] Fix | Delete
this.rotation = 0;
[54854] Fix | Delete
let angle = mk instanceof Dict ? mk.get("R") || 0 : dict.get("Rotate") || 0;
[54855] Fix | Delete
if (Number.isInteger(angle) && angle !== 0) {
[54856] Fix | Delete
angle %= 360;
[54857] Fix | Delete
if (angle < 0) {
[54858] Fix | Delete
angle += 360;
[54859] Fix | Delete
}
[54860] Fix | Delete
if (angle % 90 === 0) {
[54861] Fix | Delete
this.rotation = angle;
[54862] Fix | Delete
}
[54863] Fix | Delete
}
[54864] Fix | Delete
}
[54865] Fix | Delete
setBorderAndBackgroundColors(mk) {
[54866] Fix | Delete
if (mk instanceof Dict) {
[54867] Fix | Delete
this.borderColor = getRgbColor(mk.getArray("BC"), null);
[54868] Fix | Delete
this.backgroundColor = getRgbColor(mk.getArray("BG"), null);
[54869] Fix | Delete
} else {
[54870] Fix | Delete
this.borderColor = this.backgroundColor = null;
[54871] Fix | Delete
}
[54872] Fix | Delete
}
[54873] Fix | Delete
setBorderStyle(borderStyle) {
[54874] Fix | Delete
this.borderStyle = new AnnotationBorderStyle();
[54875] Fix | Delete
if (!(borderStyle instanceof Dict)) {
[54876] Fix | Delete
return;
[54877] Fix | Delete
}
[54878] Fix | Delete
if (borderStyle.has("BS")) {
[54879] Fix | Delete
const dict = borderStyle.get("BS");
[54880] Fix | Delete
if (dict instanceof Dict) {
[54881] Fix | Delete
const dictType = dict.get("Type");
[54882] Fix | Delete
if (!dictType || isName(dictType, "Border")) {
[54883] Fix | Delete
this.borderStyle.setWidth(dict.get("W"), this.rectangle);
[54884] Fix | Delete
this.borderStyle.setStyle(dict.get("S"));
[54885] Fix | Delete
this.borderStyle.setDashArray(dict.getArray("D"));
[54886] Fix | Delete
}
[54887] Fix | Delete
}
[54888] Fix | Delete
} else if (borderStyle.has("Border")) {
[54889] Fix | Delete
const array = borderStyle.getArray("Border");
[54890] Fix | Delete
if (Array.isArray(array) && array.length >= 3) {
[54891] Fix | Delete
this.borderStyle.setHorizontalCornerRadius(array[0]);
[54892] Fix | Delete
this.borderStyle.setVerticalCornerRadius(array[1]);
[54893] Fix | Delete
this.borderStyle.setWidth(array[2], this.rectangle);
[54894] Fix | Delete
if (array.length === 4) {
[54895] Fix | Delete
this.borderStyle.setDashArray(array[3], true);
[54896] Fix | Delete
}
[54897] Fix | Delete
}
[54898] Fix | Delete
} else {
[54899] Fix | Delete
this.borderStyle.setWidth(0);
[54900] Fix | Delete
}
[54901] Fix | Delete
}
[54902] Fix | Delete
setAppearance(dict) {
[54903] Fix | Delete
this.appearance = null;
[54904] Fix | Delete
const appearanceStates = dict.get("AP");
[54905] Fix | Delete
if (!(appearanceStates instanceof Dict)) {
[54906] Fix | Delete
return;
[54907] Fix | Delete
}
[54908] Fix | Delete
const normalAppearanceState = appearanceStates.get("N");
[54909] Fix | Delete
if (normalAppearanceState instanceof BaseStream) {
[54910] Fix | Delete
this.appearance = normalAppearanceState;
[54911] Fix | Delete
return;
[54912] Fix | Delete
}
[54913] Fix | Delete
if (!(normalAppearanceState instanceof Dict)) {
[54914] Fix | Delete
return;
[54915] Fix | Delete
}
[54916] Fix | Delete
const as = dict.get("AS");
[54917] Fix | Delete
if (!(as instanceof Name) || !normalAppearanceState.has(as.name)) {
[54918] Fix | Delete
return;
[54919] Fix | Delete
}
[54920] Fix | Delete
const appearance = normalAppearanceState.get(as.name);
[54921] Fix | Delete
if (appearance instanceof BaseStream) {
[54922] Fix | Delete
this.appearance = appearance;
[54923] Fix | Delete
}
[54924] Fix | Delete
}
[54925] Fix | Delete
setOptionalContent(dict) {
[54926] Fix | Delete
this.oc = null;
[54927] Fix | Delete
const oc = dict.get("OC");
[54928] Fix | Delete
if (oc instanceof Name) {
[54929] Fix | Delete
warn("setOptionalContent: Support for /Name-entry is not implemented.");
[54930] Fix | Delete
} else if (oc instanceof Dict) {
[54931] Fix | Delete
this.oc = oc;
[54932] Fix | Delete
}
[54933] Fix | Delete
}
[54934] Fix | Delete
loadResources(keys, appearance) {
[54935] Fix | Delete
return appearance.dict.getAsync("Resources").then(resources => {
[54936] Fix | Delete
if (!resources) {
[54937] Fix | Delete
return undefined;
[54938] Fix | Delete
}
[54939] Fix | Delete
const objectLoader = new ObjectLoader(resources, keys, resources.xref);
[54940] Fix | Delete
return objectLoader.load().then(function () {
[54941] Fix | Delete
return resources;
[54942] Fix | Delete
});
[54943] Fix | Delete
});
[54944] Fix | Delete
}
[54945] Fix | Delete
async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
[54946] Fix | Delete
const {
[54947] Fix | Delete
hasOwnCanvas,
[54948] Fix | Delete
id,
[54949] Fix | Delete
rect
[54950] Fix | Delete
} = this.data;
[54951] Fix | Delete
let appearance = this.appearance;
[54952] Fix | Delete
const isUsingOwnCanvas = !!(hasOwnCanvas && intent & RenderingIntentFlag.DISPLAY);
[54953] Fix | Delete
if (isUsingOwnCanvas && (rect[0] === rect[2] || rect[1] === rect[3])) {
[54954] Fix | Delete
this.data.hasOwnCanvas = false;
[54955] Fix | Delete
return {
[54956] Fix | Delete
opList: new OperatorList(),
[54957] Fix | Delete
separateForm: false,
[54958] Fix | Delete
separateCanvas: false
[54959] Fix | Delete
};
[54960] Fix | Delete
}
[54961] Fix | Delete
if (!appearance) {
[54962] Fix | Delete
if (!isUsingOwnCanvas) {
[54963] Fix | Delete
return {
[54964] Fix | Delete
opList: new OperatorList(),
[54965] Fix | Delete
separateForm: false,
[54966] Fix | Delete
separateCanvas: false
[54967] Fix | Delete
};
[54968] Fix | Delete
}
[54969] Fix | Delete
appearance = new StringStream("");
[54970] Fix | Delete
appearance.dict = new Dict();
[54971] Fix | Delete
}
[54972] Fix | Delete
const appearanceDict = appearance.dict;
[54973] Fix | Delete
const resources = await this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"], appearance);
[54974] Fix | Delete
const bbox = lookupRect(appearanceDict.getArray("BBox"), [0, 0, 1, 1]);
[54975] Fix | Delete
const matrix = lookupMatrix(appearanceDict.getArray("Matrix"), IDENTITY_MATRIX);
[54976] Fix | Delete
const transform = getTransformMatrix(rect, bbox, matrix);
[54977] Fix | Delete
const opList = new OperatorList();
[54978] Fix | Delete
let optionalContent;
[54979] Fix | Delete
if (this.oc) {
[54980] Fix | Delete
optionalContent = await evaluator.parseMarkedContentProps(this.oc, null);
[54981] Fix | Delete
}
[54982] Fix | Delete
if (optionalContent !== undefined) {
[54983] Fix | Delete
opList.addOp(OPS.beginMarkedContentProps, ["OC", optionalContent]);
[54984] Fix | Delete
}
[54985] Fix | Delete
opList.addOp(OPS.beginAnnotation, [id, rect, transform, matrix, isUsingOwnCanvas]);
[54986] Fix | Delete
await evaluator.getOperatorList({
[54987] Fix | Delete
stream: appearance,
[54988] Fix | Delete
task,
[54989] Fix | Delete
resources,
[54990] Fix | Delete
operatorList: opList,
[54991] Fix | Delete
fallbackFontDict: this._fallbackFontDict
[54992] Fix | Delete
});
[54993] Fix | Delete
opList.addOp(OPS.endAnnotation, []);
[54994] Fix | Delete
if (optionalContent !== undefined) {
[54995] Fix | Delete
opList.addOp(OPS.endMarkedContent, []);
[54996] Fix | Delete
}
[54997] Fix | Delete
this.reset();
[54998] Fix | Delete
return {
[54999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function