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
lastSpacePosInStringEnd = -1,
[56000] Fix | Delete
lastSpacePos = -1,
[56001] Fix | Delete
startChunk = 0,
[56002] Fix | Delete
currentWidth = 0;
[56003] Fix | Delete
for (let i = 0, ii = glyphs.length; i < ii; i++) {
[56004] Fix | Delete
const [start, end] = positions[i];
[56005] Fix | Delete
const glyph = glyphs[i];
[56006] Fix | Delete
const glyphWidth = glyph.width * scale;
[56007] Fix | Delete
if (glyph.unicode === " ") {
[56008] Fix | Delete
if (currentWidth + glyphWidth > width) {
[56009] Fix | Delete
chunks.push(line.substring(startChunk, start));
[56010] Fix | Delete
startChunk = start;
[56011] Fix | Delete
currentWidth = glyphWidth;
[56012] Fix | Delete
lastSpacePosInStringStart = -1;
[56013] Fix | Delete
lastSpacePos = -1;
[56014] Fix | Delete
} else {
[56015] Fix | Delete
currentWidth += glyphWidth;
[56016] Fix | Delete
lastSpacePosInStringStart = start;
[56017] Fix | Delete
lastSpacePosInStringEnd = end;
[56018] Fix | Delete
lastSpacePos = i;
[56019] Fix | Delete
}
[56020] Fix | Delete
} else if (currentWidth + glyphWidth > width) {
[56021] Fix | Delete
if (lastSpacePosInStringStart !== -1) {
[56022] Fix | Delete
chunks.push(line.substring(startChunk, lastSpacePosInStringEnd));
[56023] Fix | Delete
startChunk = lastSpacePosInStringEnd;
[56024] Fix | Delete
i = lastSpacePos + 1;
[56025] Fix | Delete
lastSpacePosInStringStart = -1;
[56026] Fix | Delete
currentWidth = 0;
[56027] Fix | Delete
} else {
[56028] Fix | Delete
chunks.push(line.substring(startChunk, start));
[56029] Fix | Delete
startChunk = start;
[56030] Fix | Delete
currentWidth = glyphWidth;
[56031] Fix | Delete
}
[56032] Fix | Delete
} else {
[56033] Fix | Delete
currentWidth += glyphWidth;
[56034] Fix | Delete
}
[56035] Fix | Delete
}
[56036] Fix | Delete
if (startChunk < line.length) {
[56037] Fix | Delete
chunks.push(line.substring(startChunk, line.length));
[56038] Fix | Delete
}
[56039] Fix | Delete
return chunks;
[56040] Fix | Delete
}
[56041] Fix | Delete
getFieldObject() {
[56042] Fix | Delete
return {
[56043] Fix | Delete
id: this.data.id,
[56044] Fix | Delete
value: this.data.fieldValue,
[56045] Fix | Delete
defaultValue: this.data.defaultFieldValue || "",
[56046] Fix | Delete
multiline: this.data.multiLine,
[56047] Fix | Delete
password: this.hasFieldFlag(AnnotationFieldFlag.PASSWORD),
[56048] Fix | Delete
charLimit: this.data.maxLen,
[56049] Fix | Delete
comb: this.data.comb,
[56050] Fix | Delete
editable: !this.data.readOnly,
[56051] Fix | Delete
hidden: this.data.hidden,
[56052] Fix | Delete
name: this.data.fieldName,
[56053] Fix | Delete
rect: this.data.rect,
[56054] Fix | Delete
actions: this.data.actions,
[56055] Fix | Delete
page: this.data.pageIndex,
[56056] Fix | Delete
strokeColor: this.data.borderColor,
[56057] Fix | Delete
fillColor: this.data.backgroundColor,
[56058] Fix | Delete
rotation: this.rotation,
[56059] Fix | Delete
type: "text"
[56060] Fix | Delete
};
[56061] Fix | Delete
}
[56062] Fix | Delete
}
[56063] Fix | Delete
class ButtonWidgetAnnotation extends WidgetAnnotation {
[56064] Fix | Delete
constructor(params) {
[56065] Fix | Delete
super(params);
[56066] Fix | Delete
this.checkedAppearance = null;
[56067] Fix | Delete
this.uncheckedAppearance = null;
[56068] Fix | Delete
this.data.checkBox = !this.hasFieldFlag(AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON);
[56069] Fix | Delete
this.data.radioButton = this.hasFieldFlag(AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON);
[56070] Fix | Delete
this.data.pushButton = this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON);
[56071] Fix | Delete
this.data.isTooltipOnly = false;
[56072] Fix | Delete
if (this.data.checkBox) {
[56073] Fix | Delete
this._processCheckBox(params);
[56074] Fix | Delete
} else if (this.data.radioButton) {
[56075] Fix | Delete
this._processRadioButton(params);
[56076] Fix | Delete
} else if (this.data.pushButton) {
[56077] Fix | Delete
this.data.hasOwnCanvas = true;
[56078] Fix | Delete
this.data.noHTML = false;
[56079] Fix | Delete
this._processPushButton(params);
[56080] Fix | Delete
} else {
[56081] Fix | Delete
warn("Invalid field flags for button widget annotation");
[56082] Fix | Delete
}
[56083] Fix | Delete
}
[56084] Fix | Delete
async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
[56085] Fix | Delete
if (this.data.pushButton) {
[56086] Fix | Delete
return super.getOperatorList(evaluator, task, intent, false, annotationStorage);
[56087] Fix | Delete
}
[56088] Fix | Delete
let value = null;
[56089] Fix | Delete
let rotation = null;
[56090] Fix | Delete
if (annotationStorage) {
[56091] Fix | Delete
const storageEntry = annotationStorage.get(this.data.id);
[56092] Fix | Delete
value = storageEntry ? storageEntry.value : null;
[56093] Fix | Delete
rotation = storageEntry ? storageEntry.rotation : null;
[56094] Fix | Delete
}
[56095] Fix | Delete
if (value === null && this.appearance) {
[56096] Fix | Delete
return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
[56097] Fix | Delete
}
[56098] Fix | Delete
if (value === null || value === undefined) {
[56099] Fix | Delete
value = this.data.checkBox ? this.data.fieldValue === this.data.exportValue : this.data.fieldValue === this.data.buttonValue;
[56100] Fix | Delete
}
[56101] Fix | Delete
const appearance = value ? this.checkedAppearance : this.uncheckedAppearance;
[56102] Fix | Delete
if (appearance) {
[56103] Fix | Delete
const savedAppearance = this.appearance;
[56104] Fix | Delete
const savedMatrix = lookupMatrix(appearance.dict.getArray("Matrix"), IDENTITY_MATRIX);
[56105] Fix | Delete
if (rotation) {
[56106] Fix | Delete
appearance.dict.set("Matrix", this.getRotationMatrix(annotationStorage));
[56107] Fix | Delete
}
[56108] Fix | Delete
this.appearance = appearance;
[56109] Fix | Delete
const operatorList = super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
[56110] Fix | Delete
this.appearance = savedAppearance;
[56111] Fix | Delete
appearance.dict.set("Matrix", savedMatrix);
[56112] Fix | Delete
return operatorList;
[56113] Fix | Delete
}
[56114] Fix | Delete
return {
[56115] Fix | Delete
opList: new OperatorList(),
[56116] Fix | Delete
separateForm: false,
[56117] Fix | Delete
separateCanvas: false
[56118] Fix | Delete
};
[56119] Fix | Delete
}
[56120] Fix | Delete
async save(evaluator, task, annotationStorage) {
[56121] Fix | Delete
if (this.data.checkBox) {
[56122] Fix | Delete
return this._saveCheckbox(evaluator, task, annotationStorage);
[56123] Fix | Delete
}
[56124] Fix | Delete
if (this.data.radioButton) {
[56125] Fix | Delete
return this._saveRadioButton(evaluator, task, annotationStorage);
[56126] Fix | Delete
}
[56127] Fix | Delete
return null;
[56128] Fix | Delete
}
[56129] Fix | Delete
async _saveCheckbox(evaluator, task, annotationStorage) {
[56130] Fix | Delete
if (!annotationStorage) {
[56131] Fix | Delete
return null;
[56132] Fix | Delete
}
[56133] Fix | Delete
const storageEntry = annotationStorage.get(this.data.id);
[56134] Fix | Delete
let rotation = storageEntry?.rotation,
[56135] Fix | Delete
value = storageEntry?.value;
[56136] Fix | Delete
if (rotation === undefined) {
[56137] Fix | Delete
if (value === undefined) {
[56138] Fix | Delete
return null;
[56139] Fix | Delete
}
[56140] Fix | Delete
const defaultValue = this.data.fieldValue === this.data.exportValue;
[56141] Fix | Delete
if (defaultValue === value) {
[56142] Fix | Delete
return null;
[56143] Fix | Delete
}
[56144] Fix | Delete
}
[56145] Fix | Delete
const dict = evaluator.xref.fetchIfRef(this.ref);
[56146] Fix | Delete
if (!(dict instanceof Dict)) {
[56147] Fix | Delete
return null;
[56148] Fix | Delete
}
[56149] Fix | Delete
if (rotation === undefined) {
[56150] Fix | Delete
rotation = this.rotation;
[56151] Fix | Delete
}
[56152] Fix | Delete
if (value === undefined) {
[56153] Fix | Delete
value = this.data.fieldValue === this.data.exportValue;
[56154] Fix | Delete
}
[56155] Fix | Delete
const xfa = {
[56156] Fix | Delete
path: this.data.fieldName,
[56157] Fix | Delete
value: value ? this.data.exportValue : ""
[56158] Fix | Delete
};
[56159] Fix | Delete
const name = Name.get(value ? this.data.exportValue : "Off");
[56160] Fix | Delete
dict.set("V", name);
[56161] Fix | Delete
dict.set("AS", name);
[56162] Fix | Delete
dict.set("M", `D:${getModificationDate()}`);
[56163] Fix | Delete
const maybeMK = this._getMKDict(rotation);
[56164] Fix | Delete
if (maybeMK) {
[56165] Fix | Delete
dict.set("MK", maybeMK);
[56166] Fix | Delete
}
[56167] Fix | Delete
const buffer = [];
[56168] Fix | Delete
await writeObject(this.ref, dict, buffer, evaluator.xref);
[56169] Fix | Delete
return [{
[56170] Fix | Delete
ref: this.ref,
[56171] Fix | Delete
data: buffer.join(""),
[56172] Fix | Delete
xfa
[56173] Fix | Delete
}];
[56174] Fix | Delete
}
[56175] Fix | Delete
async _saveRadioButton(evaluator, task, annotationStorage) {
[56176] Fix | Delete
if (!annotationStorage) {
[56177] Fix | Delete
return null;
[56178] Fix | Delete
}
[56179] Fix | Delete
const storageEntry = annotationStorage.get(this.data.id);
[56180] Fix | Delete
let rotation = storageEntry?.rotation,
[56181] Fix | Delete
value = storageEntry?.value;
[56182] Fix | Delete
if (rotation === undefined) {
[56183] Fix | Delete
if (value === undefined) {
[56184] Fix | Delete
return null;
[56185] Fix | Delete
}
[56186] Fix | Delete
const defaultValue = this.data.fieldValue === this.data.buttonValue;
[56187] Fix | Delete
if (defaultValue === value) {
[56188] Fix | Delete
return null;
[56189] Fix | Delete
}
[56190] Fix | Delete
}
[56191] Fix | Delete
const dict = evaluator.xref.fetchIfRef(this.ref);
[56192] Fix | Delete
if (!(dict instanceof Dict)) {
[56193] Fix | Delete
return null;
[56194] Fix | Delete
}
[56195] Fix | Delete
if (value === undefined) {
[56196] Fix | Delete
value = this.data.fieldValue === this.data.buttonValue;
[56197] Fix | Delete
}
[56198] Fix | Delete
if (rotation === undefined) {
[56199] Fix | Delete
rotation = this.rotation;
[56200] Fix | Delete
}
[56201] Fix | Delete
const xfa = {
[56202] Fix | Delete
path: this.data.fieldName,
[56203] Fix | Delete
value: value ? this.data.buttonValue : ""
[56204] Fix | Delete
};
[56205] Fix | Delete
const name = Name.get(value ? this.data.buttonValue : "Off");
[56206] Fix | Delete
const buffer = [];
[56207] Fix | Delete
let parentData = null;
[56208] Fix | Delete
if (value) {
[56209] Fix | Delete
if (this.parent instanceof Ref) {
[56210] Fix | Delete
const parent = evaluator.xref.fetch(this.parent);
[56211] Fix | Delete
parent.set("V", name);
[56212] Fix | Delete
await writeObject(this.parent, parent, buffer, evaluator.xref);
[56213] Fix | Delete
parentData = buffer.join("");
[56214] Fix | Delete
buffer.length = 0;
[56215] Fix | Delete
} else if (this.parent instanceof Dict) {
[56216] Fix | Delete
this.parent.set("V", name);
[56217] Fix | Delete
}
[56218] Fix | Delete
}
[56219] Fix | Delete
dict.set("AS", name);
[56220] Fix | Delete
dict.set("M", `D:${getModificationDate()}`);
[56221] Fix | Delete
const maybeMK = this._getMKDict(rotation);
[56222] Fix | Delete
if (maybeMK) {
[56223] Fix | Delete
dict.set("MK", maybeMK);
[56224] Fix | Delete
}
[56225] Fix | Delete
await writeObject(this.ref, dict, buffer, evaluator.xref);
[56226] Fix | Delete
const newRefs = [{
[56227] Fix | Delete
ref: this.ref,
[56228] Fix | Delete
data: buffer.join(""),
[56229] Fix | Delete
xfa
[56230] Fix | Delete
}];
[56231] Fix | Delete
if (parentData) {
[56232] Fix | Delete
newRefs.push({
[56233] Fix | Delete
ref: this.parent,
[56234] Fix | Delete
data: parentData,
[56235] Fix | Delete
xfa: null
[56236] Fix | Delete
});
[56237] Fix | Delete
}
[56238] Fix | Delete
return newRefs;
[56239] Fix | Delete
}
[56240] Fix | Delete
_getDefaultCheckedAppearance(params, type) {
[56241] Fix | Delete
const width = this.data.rect[2] - this.data.rect[0];
[56242] Fix | Delete
const height = this.data.rect[3] - this.data.rect[1];
[56243] Fix | Delete
const bbox = [0, 0, width, height];
[56244] Fix | Delete
const FONT_RATIO = 0.8;
[56245] Fix | Delete
const fontSize = Math.min(width, height) * FONT_RATIO;
[56246] Fix | Delete
let metrics, char;
[56247] Fix | Delete
if (type === "check") {
[56248] Fix | Delete
metrics = {
[56249] Fix | Delete
width: 0.755 * fontSize,
[56250] Fix | Delete
height: 0.705 * fontSize
[56251] Fix | Delete
};
[56252] Fix | Delete
char = "\x33";
[56253] Fix | Delete
} else if (type === "disc") {
[56254] Fix | Delete
metrics = {
[56255] Fix | Delete
width: 0.791 * fontSize,
[56256] Fix | Delete
height: 0.705 * fontSize
[56257] Fix | Delete
};
[56258] Fix | Delete
char = "\x6C";
[56259] Fix | Delete
} else {
[56260] Fix | Delete
unreachable(`_getDefaultCheckedAppearance - unsupported type: ${type}`);
[56261] Fix | Delete
}
[56262] Fix | Delete
const xShift = numberToString((width - metrics.width) / 2);
[56263] Fix | Delete
const yShift = numberToString((height - metrics.height) / 2);
[56264] Fix | Delete
const appearance = `q BT /PdfJsZaDb ${fontSize} Tf 0 g ${xShift} ${yShift} Td (${char}) Tj ET Q`;
[56265] Fix | Delete
const appearanceStreamDict = new Dict(params.xref);
[56266] Fix | Delete
appearanceStreamDict.set("FormType", 1);
[56267] Fix | Delete
appearanceStreamDict.set("Subtype", Name.get("Form"));
[56268] Fix | Delete
appearanceStreamDict.set("Type", Name.get("XObject"));
[56269] Fix | Delete
appearanceStreamDict.set("BBox", bbox);
[56270] Fix | Delete
appearanceStreamDict.set("Matrix", [1, 0, 0, 1, 0, 0]);
[56271] Fix | Delete
appearanceStreamDict.set("Length", appearance.length);
[56272] Fix | Delete
const resources = new Dict(params.xref);
[56273] Fix | Delete
const font = new Dict(params.xref);
[56274] Fix | Delete
font.set("PdfJsZaDb", this.fallbackFontDict);
[56275] Fix | Delete
resources.set("Font", font);
[56276] Fix | Delete
appearanceStreamDict.set("Resources", resources);
[56277] Fix | Delete
this.checkedAppearance = new StringStream(appearance);
[56278] Fix | Delete
this.checkedAppearance.dict = appearanceStreamDict;
[56279] Fix | Delete
this._streams.push(this.checkedAppearance);
[56280] Fix | Delete
}
[56281] Fix | Delete
_processCheckBox(params) {
[56282] Fix | Delete
const customAppearance = params.dict.get("AP");
[56283] Fix | Delete
if (!(customAppearance instanceof Dict)) {
[56284] Fix | Delete
return;
[56285] Fix | Delete
}
[56286] Fix | Delete
const normalAppearance = customAppearance.get("N");
[56287] Fix | Delete
if (!(normalAppearance instanceof Dict)) {
[56288] Fix | Delete
return;
[56289] Fix | Delete
}
[56290] Fix | Delete
const asValue = this._decodeFormValue(params.dict.get("AS"));
[56291] Fix | Delete
if (typeof asValue === "string") {
[56292] Fix | Delete
this.data.fieldValue = asValue;
[56293] Fix | Delete
}
[56294] Fix | Delete
const yes = this.data.fieldValue !== null && this.data.fieldValue !== "Off" ? this.data.fieldValue : "Yes";
[56295] Fix | Delete
const exportValues = normalAppearance.getKeys();
[56296] Fix | Delete
if (exportValues.length === 0) {
[56297] Fix | Delete
exportValues.push("Off", yes);
[56298] Fix | Delete
} else if (exportValues.length === 1) {
[56299] Fix | Delete
if (exportValues[0] === "Off") {
[56300] Fix | Delete
exportValues.push(yes);
[56301] Fix | Delete
} else {
[56302] Fix | Delete
exportValues.unshift("Off");
[56303] Fix | Delete
}
[56304] Fix | Delete
} else if (exportValues.includes(yes)) {
[56305] Fix | Delete
exportValues.length = 0;
[56306] Fix | Delete
exportValues.push("Off", yes);
[56307] Fix | Delete
} else {
[56308] Fix | Delete
const otherYes = exportValues.find(v => v !== "Off");
[56309] Fix | Delete
exportValues.length = 0;
[56310] Fix | Delete
exportValues.push("Off", otherYes);
[56311] Fix | Delete
}
[56312] Fix | Delete
if (!exportValues.includes(this.data.fieldValue)) {
[56313] Fix | Delete
this.data.fieldValue = "Off";
[56314] Fix | Delete
}
[56315] Fix | Delete
this.data.exportValue = exportValues[1];
[56316] Fix | Delete
const checkedAppearance = normalAppearance.get(this.data.exportValue);
[56317] Fix | Delete
this.checkedAppearance = checkedAppearance instanceof BaseStream ? checkedAppearance : null;
[56318] Fix | Delete
const uncheckedAppearance = normalAppearance.get("Off");
[56319] Fix | Delete
this.uncheckedAppearance = uncheckedAppearance instanceof BaseStream ? uncheckedAppearance : null;
[56320] Fix | Delete
if (this.checkedAppearance) {
[56321] Fix | Delete
this._streams.push(this.checkedAppearance);
[56322] Fix | Delete
} else {
[56323] Fix | Delete
this._getDefaultCheckedAppearance(params, "check");
[56324] Fix | Delete
}
[56325] Fix | Delete
if (this.uncheckedAppearance) {
[56326] Fix | Delete
this._streams.push(this.uncheckedAppearance);
[56327] Fix | Delete
}
[56328] Fix | Delete
this._fallbackFontDict = this.fallbackFontDict;
[56329] Fix | Delete
if (this.data.defaultFieldValue === null) {
[56330] Fix | Delete
this.data.defaultFieldValue = "Off";
[56331] Fix | Delete
}
[56332] Fix | Delete
}
[56333] Fix | Delete
_processRadioButton(params) {
[56334] Fix | Delete
this.data.buttonValue = null;
[56335] Fix | Delete
const fieldParent = params.dict.get("Parent");
[56336] Fix | Delete
if (fieldParent instanceof Dict) {
[56337] Fix | Delete
this.parent = params.dict.getRaw("Parent");
[56338] Fix | Delete
const fieldParentValue = fieldParent.get("V");
[56339] Fix | Delete
if (fieldParentValue instanceof Name) {
[56340] Fix | Delete
this.data.fieldValue = this._decodeFormValue(fieldParentValue);
[56341] Fix | Delete
}
[56342] Fix | Delete
}
[56343] Fix | Delete
const appearanceStates = params.dict.get("AP");
[56344] Fix | Delete
if (!(appearanceStates instanceof Dict)) {
[56345] Fix | Delete
return;
[56346] Fix | Delete
}
[56347] Fix | Delete
const normalAppearance = appearanceStates.get("N");
[56348] Fix | Delete
if (!(normalAppearance instanceof Dict)) {
[56349] Fix | Delete
return;
[56350] Fix | Delete
}
[56351] Fix | Delete
for (const key of normalAppearance.getKeys()) {
[56352] Fix | Delete
if (key !== "Off") {
[56353] Fix | Delete
this.data.buttonValue = this._decodeFormValue(key);
[56354] Fix | Delete
break;
[56355] Fix | Delete
}
[56356] Fix | Delete
}
[56357] Fix | Delete
const checkedAppearance = normalAppearance.get(this.data.buttonValue);
[56358] Fix | Delete
this.checkedAppearance = checkedAppearance instanceof BaseStream ? checkedAppearance : null;
[56359] Fix | Delete
const uncheckedAppearance = normalAppearance.get("Off");
[56360] Fix | Delete
this.uncheckedAppearance = uncheckedAppearance instanceof BaseStream ? uncheckedAppearance : null;
[56361] Fix | Delete
if (this.checkedAppearance) {
[56362] Fix | Delete
this._streams.push(this.checkedAppearance);
[56363] Fix | Delete
} else {
[56364] Fix | Delete
this._getDefaultCheckedAppearance(params, "disc");
[56365] Fix | Delete
}
[56366] Fix | Delete
if (this.uncheckedAppearance) {
[56367] Fix | Delete
this._streams.push(this.uncheckedAppearance);
[56368] Fix | Delete
}
[56369] Fix | Delete
this._fallbackFontDict = this.fallbackFontDict;
[56370] Fix | Delete
if (this.data.defaultFieldValue === null) {
[56371] Fix | Delete
this.data.defaultFieldValue = "Off";
[56372] Fix | Delete
}
[56373] Fix | Delete
}
[56374] Fix | Delete
_processPushButton(params) {
[56375] Fix | Delete
const {
[56376] Fix | Delete
dict,
[56377] Fix | Delete
annotationGlobals
[56378] Fix | Delete
} = params;
[56379] Fix | Delete
if (!dict.has("A") && !dict.has("AA") && !this.data.alternativeText) {
[56380] Fix | Delete
warn("Push buttons without action dictionaries are not supported");
[56381] Fix | Delete
return;
[56382] Fix | Delete
}
[56383] Fix | Delete
this.data.isTooltipOnly = !dict.has("A") && !dict.has("AA");
[56384] Fix | Delete
Catalog.parseDestDictionary({
[56385] Fix | Delete
destDict: dict,
[56386] Fix | Delete
resultObj: this.data,
[56387] Fix | Delete
docBaseUrl: annotationGlobals.baseUrl,
[56388] Fix | Delete
docAttachments: annotationGlobals.attachments
[56389] Fix | Delete
});
[56390] Fix | Delete
}
[56391] Fix | Delete
getFieldObject() {
[56392] Fix | Delete
let type = "button";
[56393] Fix | Delete
let exportValues;
[56394] Fix | Delete
if (this.data.checkBox) {
[56395] Fix | Delete
type = "checkbox";
[56396] Fix | Delete
exportValues = this.data.exportValue;
[56397] Fix | Delete
} else if (this.data.radioButton) {
[56398] Fix | Delete
type = "radiobutton";
[56399] Fix | Delete
exportValues = this.data.buttonValue;
[56400] Fix | Delete
}
[56401] Fix | Delete
return {
[56402] Fix | Delete
id: this.data.id,
[56403] Fix | Delete
value: this.data.fieldValue || "Off",
[56404] Fix | Delete
defaultValue: this.data.defaultFieldValue,
[56405] Fix | Delete
exportValues,
[56406] Fix | Delete
editable: !this.data.readOnly,
[56407] Fix | Delete
name: this.data.fieldName,
[56408] Fix | Delete
rect: this.data.rect,
[56409] Fix | Delete
hidden: this.data.hidden,
[56410] Fix | Delete
actions: this.data.actions,
[56411] Fix | Delete
page: this.data.pageIndex,
[56412] Fix | Delete
strokeColor: this.data.borderColor,
[56413] Fix | Delete
fillColor: this.data.backgroundColor,
[56414] Fix | Delete
rotation: this.rotation,
[56415] Fix | Delete
type
[56416] Fix | Delete
};
[56417] Fix | Delete
}
[56418] Fix | Delete
get fallbackFontDict() {
[56419] Fix | Delete
const dict = new Dict();
[56420] Fix | Delete
dict.set("BaseFont", Name.get("ZapfDingbats"));
[56421] Fix | Delete
dict.set("Type", Name.get("FallbackType"));
[56422] Fix | Delete
dict.set("Subtype", Name.get("FallbackType"));
[56423] Fix | Delete
dict.set("Encoding", Name.get("ZapfDingbatsEncoding"));
[56424] Fix | Delete
return shadow(this, "fallbackFontDict", dict);
[56425] Fix | Delete
}
[56426] Fix | Delete
}
[56427] Fix | Delete
class ChoiceWidgetAnnotation extends WidgetAnnotation {
[56428] Fix | Delete
constructor(params) {
[56429] Fix | Delete
super(params);
[56430] Fix | Delete
const {
[56431] Fix | Delete
dict,
[56432] Fix | Delete
xref
[56433] Fix | Delete
} = params;
[56434] Fix | Delete
this.indices = dict.getArray("I");
[56435] Fix | Delete
this.hasIndices = Array.isArray(this.indices) && this.indices.length > 0;
[56436] Fix | Delete
this.data.options = [];
[56437] Fix | Delete
const options = getInheritableProperty({
[56438] Fix | Delete
dict,
[56439] Fix | Delete
key: "Opt"
[56440] Fix | Delete
});
[56441] Fix | Delete
if (Array.isArray(options)) {
[56442] Fix | Delete
for (let i = 0, ii = options.length; i < ii; i++) {
[56443] Fix | Delete
const option = xref.fetchIfRef(options[i]);
[56444] Fix | Delete
const isOptionArray = Array.isArray(option);
[56445] Fix | Delete
this.data.options[i] = {
[56446] Fix | Delete
exportValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[0]) : option),
[56447] Fix | Delete
displayValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[1]) : option)
[56448] Fix | Delete
};
[56449] Fix | Delete
}
[56450] Fix | Delete
}
[56451] Fix | Delete
if (!this.hasIndices) {
[56452] Fix | Delete
if (typeof this.data.fieldValue === "string") {
[56453] Fix | Delete
this.data.fieldValue = [this.data.fieldValue];
[56454] Fix | Delete
} else if (!this.data.fieldValue) {
[56455] Fix | Delete
this.data.fieldValue = [];
[56456] Fix | Delete
}
[56457] Fix | Delete
} else {
[56458] Fix | Delete
this.data.fieldValue = [];
[56459] Fix | Delete
const ii = this.data.options.length;
[56460] Fix | Delete
for (const i of this.indices) {
[56461] Fix | Delete
if (Number.isInteger(i) && i >= 0 && i < ii) {
[56462] Fix | Delete
this.data.fieldValue.push(this.data.options[i].exportValue);
[56463] Fix | Delete
}
[56464] Fix | Delete
}
[56465] Fix | Delete
}
[56466] Fix | Delete
this.data.combo = this.hasFieldFlag(AnnotationFieldFlag.COMBO);
[56467] Fix | Delete
this.data.multiSelect = this.hasFieldFlag(AnnotationFieldFlag.MULTISELECT);
[56468] Fix | Delete
this._hasText = true;
[56469] Fix | Delete
}
[56470] Fix | Delete
getFieldObject() {
[56471] Fix | Delete
const type = this.data.combo ? "combobox" : "listbox";
[56472] Fix | Delete
const value = this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : null;
[56473] Fix | Delete
return {
[56474] Fix | Delete
id: this.data.id,
[56475] Fix | Delete
value,
[56476] Fix | Delete
defaultValue: this.data.defaultFieldValue,
[56477] Fix | Delete
editable: !this.data.readOnly,
[56478] Fix | Delete
name: this.data.fieldName,
[56479] Fix | Delete
rect: this.data.rect,
[56480] Fix | Delete
numItems: this.data.fieldValue.length,
[56481] Fix | Delete
multipleSelection: this.data.multiSelect,
[56482] Fix | Delete
hidden: this.data.hidden,
[56483] Fix | Delete
actions: this.data.actions,
[56484] Fix | Delete
items: this.data.options,
[56485] Fix | Delete
page: this.data.pageIndex,
[56486] Fix | Delete
strokeColor: this.data.borderColor,
[56487] Fix | Delete
fillColor: this.data.backgroundColor,
[56488] Fix | Delete
rotation: this.rotation,
[56489] Fix | Delete
type
[56490] Fix | Delete
};
[56491] Fix | Delete
}
[56492] Fix | Delete
amendSavedDict(annotationStorage, dict) {
[56493] Fix | Delete
if (!this.hasIndices) {
[56494] Fix | Delete
return;
[56495] Fix | Delete
}
[56496] Fix | Delete
let values = annotationStorage?.get(this.data.id)?.value;
[56497] Fix | Delete
if (!Array.isArray(values)) {
[56498] Fix | Delete
values = [values];
[56499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function