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
this._current = this._builder.buildRoot(this._ids);
[54000] Fix | Delete
this._errorCode = XMLParserErrorCode.NoError;
[54001] Fix | Delete
this._whiteRegex = /^\s+$/;
[54002] Fix | Delete
this._nbsps = /\xa0+/g;
[54003] Fix | Delete
this._richText = richText;
[54004] Fix | Delete
}
[54005] Fix | Delete
parse(data) {
[54006] Fix | Delete
this.parseXml(data);
[54007] Fix | Delete
if (this._errorCode !== XMLParserErrorCode.NoError) {
[54008] Fix | Delete
return undefined;
[54009] Fix | Delete
}
[54010] Fix | Delete
this._current[$finalize]();
[54011] Fix | Delete
return this._current.element;
[54012] Fix | Delete
}
[54013] Fix | Delete
onText(text) {
[54014] Fix | Delete
text = text.replace(this._nbsps, match => match.slice(1) + " ");
[54015] Fix | Delete
if (this._richText || this._current[$acceptWhitespace]()) {
[54016] Fix | Delete
this._current[$onText](text, this._richText);
[54017] Fix | Delete
return;
[54018] Fix | Delete
}
[54019] Fix | Delete
if (this._whiteRegex.test(text)) {
[54020] Fix | Delete
return;
[54021] Fix | Delete
}
[54022] Fix | Delete
this._current[$onText](text.trim());
[54023] Fix | Delete
}
[54024] Fix | Delete
onCdata(text) {
[54025] Fix | Delete
this._current[$onText](text);
[54026] Fix | Delete
}
[54027] Fix | Delete
_mkAttributes(attributes, tagName) {
[54028] Fix | Delete
let namespace = null;
[54029] Fix | Delete
let prefixes = null;
[54030] Fix | Delete
const attributeObj = Object.create({});
[54031] Fix | Delete
for (const {
[54032] Fix | Delete
name,
[54033] Fix | Delete
value
[54034] Fix | Delete
} of attributes) {
[54035] Fix | Delete
if (name === "xmlns") {
[54036] Fix | Delete
if (!namespace) {
[54037] Fix | Delete
namespace = value;
[54038] Fix | Delete
} else {
[54039] Fix | Delete
warn(`XFA - multiple namespace definition in <${tagName}>`);
[54040] Fix | Delete
}
[54041] Fix | Delete
} else if (name.startsWith("xmlns:")) {
[54042] Fix | Delete
const prefix = name.substring("xmlns:".length);
[54043] Fix | Delete
if (!prefixes) {
[54044] Fix | Delete
prefixes = [];
[54045] Fix | Delete
}
[54046] Fix | Delete
prefixes.push({
[54047] Fix | Delete
prefix,
[54048] Fix | Delete
value
[54049] Fix | Delete
});
[54050] Fix | Delete
} else {
[54051] Fix | Delete
const i = name.indexOf(":");
[54052] Fix | Delete
if (i === -1) {
[54053] Fix | Delete
attributeObj[name] = value;
[54054] Fix | Delete
} else {
[54055] Fix | Delete
let nsAttrs = attributeObj[$nsAttributes];
[54056] Fix | Delete
if (!nsAttrs) {
[54057] Fix | Delete
nsAttrs = attributeObj[$nsAttributes] = Object.create(null);
[54058] Fix | Delete
}
[54059] Fix | Delete
const [ns, attrName] = [name.slice(0, i), name.slice(i + 1)];
[54060] Fix | Delete
const attrs = nsAttrs[ns] ||= Object.create(null);
[54061] Fix | Delete
attrs[attrName] = value;
[54062] Fix | Delete
}
[54063] Fix | Delete
}
[54064] Fix | Delete
}
[54065] Fix | Delete
return [namespace, prefixes, attributeObj];
[54066] Fix | Delete
}
[54067] Fix | Delete
_getNameAndPrefix(name, nsAgnostic) {
[54068] Fix | Delete
const i = name.indexOf(":");
[54069] Fix | Delete
if (i === -1) {
[54070] Fix | Delete
return [name, null];
[54071] Fix | Delete
}
[54072] Fix | Delete
return [name.substring(i + 1), nsAgnostic ? "" : name.substring(0, i)];
[54073] Fix | Delete
}
[54074] Fix | Delete
onBeginElement(tagName, attributes, isEmpty) {
[54075] Fix | Delete
const [namespace, prefixes, attributesObj] = this._mkAttributes(attributes, tagName);
[54076] Fix | Delete
const [name, nsPrefix] = this._getNameAndPrefix(tagName, this._builder.isNsAgnostic());
[54077] Fix | Delete
const node = this._builder.build({
[54078] Fix | Delete
nsPrefix,
[54079] Fix | Delete
name,
[54080] Fix | Delete
attributes: attributesObj,
[54081] Fix | Delete
namespace,
[54082] Fix | Delete
prefixes
[54083] Fix | Delete
});
[54084] Fix | Delete
node[$globalData] = this._globalData;
[54085] Fix | Delete
if (isEmpty) {
[54086] Fix | Delete
node[$finalize]();
[54087] Fix | Delete
if (this._current[$onChild](node)) {
[54088] Fix | Delete
node[$setId](this._ids);
[54089] Fix | Delete
}
[54090] Fix | Delete
node[$clean](this._builder);
[54091] Fix | Delete
return;
[54092] Fix | Delete
}
[54093] Fix | Delete
this._stack.push(this._current);
[54094] Fix | Delete
this._current = node;
[54095] Fix | Delete
}
[54096] Fix | Delete
onEndElement(name) {
[54097] Fix | Delete
const node = this._current;
[54098] Fix | Delete
if (node[$isCDATAXml]() && typeof node[$content] === "string") {
[54099] Fix | Delete
const parser = new XFAParser();
[54100] Fix | Delete
parser._globalData = this._globalData;
[54101] Fix | Delete
const root = parser.parse(node[$content]);
[54102] Fix | Delete
node[$content] = null;
[54103] Fix | Delete
node[$onChild](root);
[54104] Fix | Delete
}
[54105] Fix | Delete
node[$finalize]();
[54106] Fix | Delete
this._current = this._stack.pop();
[54107] Fix | Delete
if (this._current[$onChild](node)) {
[54108] Fix | Delete
node[$setId](this._ids);
[54109] Fix | Delete
}
[54110] Fix | Delete
node[$clean](this._builder);
[54111] Fix | Delete
}
[54112] Fix | Delete
onError(code) {
[54113] Fix | Delete
this._errorCode = code;
[54114] Fix | Delete
}
[54115] Fix | Delete
}
[54116] Fix | Delete
[54117] Fix | Delete
;// CONCATENATED MODULE: ./src/core/xfa/factory.js
[54118] Fix | Delete
[54119] Fix | Delete
[54120] Fix | Delete
[54121] Fix | Delete
[54122] Fix | Delete
[54123] Fix | Delete
[54124] Fix | Delete
[54125] Fix | Delete
[54126] Fix | Delete
[54127] Fix | Delete
[54128] Fix | Delete
[54129] Fix | Delete
[54130] Fix | Delete
[54131] Fix | Delete
class XFAFactory {
[54132] Fix | Delete
constructor(data) {
[54133] Fix | Delete
try {
[54134] Fix | Delete
this.root = new XFAParser().parse(XFAFactory._createDocument(data));
[54135] Fix | Delete
const binder = new Binder(this.root);
[54136] Fix | Delete
this.form = binder.bind();
[54137] Fix | Delete
this.dataHandler = new DataHandler(this.root, binder.getData());
[54138] Fix | Delete
this.form[$globalData].template = this.form;
[54139] Fix | Delete
} catch (e) {
[54140] Fix | Delete
warn(`XFA - an error occurred during parsing and binding: ${e}`);
[54141] Fix | Delete
}
[54142] Fix | Delete
}
[54143] Fix | Delete
isValid() {
[54144] Fix | Delete
return this.root && this.form;
[54145] Fix | Delete
}
[54146] Fix | Delete
_createPagesHelper() {
[54147] Fix | Delete
const iterator = this.form[$toPages]();
[54148] Fix | Delete
return new Promise((resolve, reject) => {
[54149] Fix | Delete
const nextIteration = () => {
[54150] Fix | Delete
try {
[54151] Fix | Delete
const value = iterator.next();
[54152] Fix | Delete
if (value.done) {
[54153] Fix | Delete
resolve(value.value);
[54154] Fix | Delete
} else {
[54155] Fix | Delete
setTimeout(nextIteration, 0);
[54156] Fix | Delete
}
[54157] Fix | Delete
} catch (e) {
[54158] Fix | Delete
reject(e);
[54159] Fix | Delete
}
[54160] Fix | Delete
};
[54161] Fix | Delete
setTimeout(nextIteration, 0);
[54162] Fix | Delete
});
[54163] Fix | Delete
}
[54164] Fix | Delete
async _createPages() {
[54165] Fix | Delete
try {
[54166] Fix | Delete
this.pages = await this._createPagesHelper();
[54167] Fix | Delete
this.dims = this.pages.children.map(c => {
[54168] Fix | Delete
const {
[54169] Fix | Delete
width,
[54170] Fix | Delete
height
[54171] Fix | Delete
} = c.attributes.style;
[54172] Fix | Delete
return [0, 0, parseInt(width), parseInt(height)];
[54173] Fix | Delete
});
[54174] Fix | Delete
} catch (e) {
[54175] Fix | Delete
warn(`XFA - an error occurred during layout: ${e}`);
[54176] Fix | Delete
}
[54177] Fix | Delete
}
[54178] Fix | Delete
getBoundingBox(pageIndex) {
[54179] Fix | Delete
return this.dims[pageIndex];
[54180] Fix | Delete
}
[54181] Fix | Delete
async getNumPages() {
[54182] Fix | Delete
if (!this.pages) {
[54183] Fix | Delete
await this._createPages();
[54184] Fix | Delete
}
[54185] Fix | Delete
return this.dims.length;
[54186] Fix | Delete
}
[54187] Fix | Delete
setImages(images) {
[54188] Fix | Delete
this.form[$globalData].images = images;
[54189] Fix | Delete
}
[54190] Fix | Delete
setFonts(fonts) {
[54191] Fix | Delete
this.form[$globalData].fontFinder = new FontFinder(fonts);
[54192] Fix | Delete
const missingFonts = [];
[54193] Fix | Delete
for (let typeface of this.form[$globalData].usedTypefaces) {
[54194] Fix | Delete
typeface = stripQuotes(typeface);
[54195] Fix | Delete
const font = this.form[$globalData].fontFinder.find(typeface);
[54196] Fix | Delete
if (!font) {
[54197] Fix | Delete
missingFonts.push(typeface);
[54198] Fix | Delete
}
[54199] Fix | Delete
}
[54200] Fix | Delete
if (missingFonts.length > 0) {
[54201] Fix | Delete
return missingFonts;
[54202] Fix | Delete
}
[54203] Fix | Delete
return null;
[54204] Fix | Delete
}
[54205] Fix | Delete
appendFonts(fonts, reallyMissingFonts) {
[54206] Fix | Delete
this.form[$globalData].fontFinder.add(fonts, reallyMissingFonts);
[54207] Fix | Delete
}
[54208] Fix | Delete
async getPages() {
[54209] Fix | Delete
if (!this.pages) {
[54210] Fix | Delete
await this._createPages();
[54211] Fix | Delete
}
[54212] Fix | Delete
const pages = this.pages;
[54213] Fix | Delete
this.pages = null;
[54214] Fix | Delete
return pages;
[54215] Fix | Delete
}
[54216] Fix | Delete
serializeData(storage) {
[54217] Fix | Delete
return this.dataHandler.serialize(storage);
[54218] Fix | Delete
}
[54219] Fix | Delete
static _createDocument(data) {
[54220] Fix | Delete
if (!data["/xdp:xdp"]) {
[54221] Fix | Delete
return data["xdp:xdp"];
[54222] Fix | Delete
}
[54223] Fix | Delete
return Object.values(data).join("");
[54224] Fix | Delete
}
[54225] Fix | Delete
static getRichTextAsHtml(rc) {
[54226] Fix | Delete
if (!rc || typeof rc !== "string") {
[54227] Fix | Delete
return null;
[54228] Fix | Delete
}
[54229] Fix | Delete
try {
[54230] Fix | Delete
let root = new XFAParser(XhtmlNamespace, true).parse(rc);
[54231] Fix | Delete
if (!["body", "xhtml"].includes(root[$nodeName])) {
[54232] Fix | Delete
const newRoot = XhtmlNamespace.body({});
[54233] Fix | Delete
newRoot[$appendChild](root);
[54234] Fix | Delete
root = newRoot;
[54235] Fix | Delete
}
[54236] Fix | Delete
const result = root[$toHTML]();
[54237] Fix | Delete
if (!result.success) {
[54238] Fix | Delete
return null;
[54239] Fix | Delete
}
[54240] Fix | Delete
const {
[54241] Fix | Delete
html
[54242] Fix | Delete
} = result;
[54243] Fix | Delete
const {
[54244] Fix | Delete
attributes
[54245] Fix | Delete
} = html;
[54246] Fix | Delete
if (attributes) {
[54247] Fix | Delete
if (attributes.class) {
[54248] Fix | Delete
attributes.class = attributes.class.filter(attr => !attr.startsWith("xfa"));
[54249] Fix | Delete
}
[54250] Fix | Delete
attributes.dir = "auto";
[54251] Fix | Delete
}
[54252] Fix | Delete
return {
[54253] Fix | Delete
html,
[54254] Fix | Delete
str: root[$text]()
[54255] Fix | Delete
};
[54256] Fix | Delete
} catch (e) {
[54257] Fix | Delete
warn(`XFA - an error occurred during parsing of rich text: ${e}`);
[54258] Fix | Delete
}
[54259] Fix | Delete
return null;
[54260] Fix | Delete
}
[54261] Fix | Delete
}
[54262] Fix | Delete
[54263] Fix | Delete
;// CONCATENATED MODULE: ./src/core/annotation.js
[54264] Fix | Delete
[54265] Fix | Delete
[54266] Fix | Delete
[54267] Fix | Delete
[54268] Fix | Delete
[54269] Fix | Delete
[54270] Fix | Delete
[54271] Fix | Delete
[54272] Fix | Delete
[54273] Fix | Delete
[54274] Fix | Delete
[54275] Fix | Delete
[54276] Fix | Delete
[54277] Fix | Delete
[54278] Fix | Delete
[54279] Fix | Delete
[54280] Fix | Delete
[54281] Fix | Delete
[54282] Fix | Delete
[54283] Fix | Delete
[54284] Fix | Delete
[54285] Fix | Delete
[54286] Fix | Delete
[54287] Fix | Delete
[54288] Fix | Delete
[54289] Fix | Delete
[54290] Fix | Delete
[54291] Fix | Delete
[54292] Fix | Delete
[54293] Fix | Delete
[54294] Fix | Delete
class AnnotationFactory {
[54295] Fix | Delete
static createGlobals(pdfManager) {
[54296] Fix | Delete
return Promise.all([pdfManager.ensureCatalog("acroForm"), pdfManager.ensureDoc("xfaDatasets"), pdfManager.ensureCatalog("structTreeRoot"), pdfManager.ensureCatalog("baseUrl"), pdfManager.ensureCatalog("attachments")]).then(([acroForm, xfaDatasets, structTreeRoot, baseUrl, attachments]) => {
[54297] Fix | Delete
return {
[54298] Fix | Delete
pdfManager,
[54299] Fix | Delete
acroForm: acroForm instanceof Dict ? acroForm : Dict.empty,
[54300] Fix | Delete
xfaDatasets,
[54301] Fix | Delete
structTreeRoot,
[54302] Fix | Delete
baseUrl,
[54303] Fix | Delete
attachments
[54304] Fix | Delete
};
[54305] Fix | Delete
}, reason => {
[54306] Fix | Delete
warn(`createGlobals: "${reason}".`);
[54307] Fix | Delete
return null;
[54308] Fix | Delete
});
[54309] Fix | Delete
}
[54310] Fix | Delete
static async create(xref, ref, annotationGlobals, idFactory, collectFields, pageRef) {
[54311] Fix | Delete
const pageIndex = collectFields ? await this._getPageIndex(xref, ref, annotationGlobals.pdfManager) : null;
[54312] Fix | Delete
return annotationGlobals.pdfManager.ensure(this, "_create", [xref, ref, annotationGlobals, idFactory, collectFields, pageIndex, pageRef]);
[54313] Fix | Delete
}
[54314] Fix | Delete
static _create(xref, ref, annotationGlobals, idFactory, collectFields = false, pageIndex = null, pageRef = null) {
[54315] Fix | Delete
const dict = xref.fetchIfRef(ref);
[54316] Fix | Delete
if (!(dict instanceof Dict)) {
[54317] Fix | Delete
return undefined;
[54318] Fix | Delete
}
[54319] Fix | Delete
const {
[54320] Fix | Delete
acroForm,
[54321] Fix | Delete
pdfManager
[54322] Fix | Delete
} = annotationGlobals;
[54323] Fix | Delete
const id = ref instanceof Ref ? ref.toString() : `annot_${idFactory.createObjId()}`;
[54324] Fix | Delete
let subtype = dict.get("Subtype");
[54325] Fix | Delete
subtype = subtype instanceof Name ? subtype.name : null;
[54326] Fix | Delete
const parameters = {
[54327] Fix | Delete
xref,
[54328] Fix | Delete
ref,
[54329] Fix | Delete
dict,
[54330] Fix | Delete
subtype,
[54331] Fix | Delete
id,
[54332] Fix | Delete
annotationGlobals,
[54333] Fix | Delete
collectFields,
[54334] Fix | Delete
needAppearances: !collectFields && acroForm.get("NeedAppearances") === true,
[54335] Fix | Delete
pageIndex,
[54336] Fix | Delete
evaluatorOptions: pdfManager.evaluatorOptions,
[54337] Fix | Delete
pageRef
[54338] Fix | Delete
};
[54339] Fix | Delete
switch (subtype) {
[54340] Fix | Delete
case "Link":
[54341] Fix | Delete
return new LinkAnnotation(parameters);
[54342] Fix | Delete
case "Text":
[54343] Fix | Delete
return new TextAnnotation(parameters);
[54344] Fix | Delete
case "Widget":
[54345] Fix | Delete
let fieldType = getInheritableProperty({
[54346] Fix | Delete
dict,
[54347] Fix | Delete
key: "FT"
[54348] Fix | Delete
});
[54349] Fix | Delete
fieldType = fieldType instanceof Name ? fieldType.name : null;
[54350] Fix | Delete
switch (fieldType) {
[54351] Fix | Delete
case "Tx":
[54352] Fix | Delete
return new TextWidgetAnnotation(parameters);
[54353] Fix | Delete
case "Btn":
[54354] Fix | Delete
return new ButtonWidgetAnnotation(parameters);
[54355] Fix | Delete
case "Ch":
[54356] Fix | Delete
return new ChoiceWidgetAnnotation(parameters);
[54357] Fix | Delete
case "Sig":
[54358] Fix | Delete
return new SignatureWidgetAnnotation(parameters);
[54359] Fix | Delete
}
[54360] Fix | Delete
warn(`Unimplemented widget field type "${fieldType}", ` + "falling back to base field type.");
[54361] Fix | Delete
return new WidgetAnnotation(parameters);
[54362] Fix | Delete
case "Popup":
[54363] Fix | Delete
return new PopupAnnotation(parameters);
[54364] Fix | Delete
case "FreeText":
[54365] Fix | Delete
return new FreeTextAnnotation(parameters);
[54366] Fix | Delete
case "Line":
[54367] Fix | Delete
return new LineAnnotation(parameters);
[54368] Fix | Delete
case "Square":
[54369] Fix | Delete
return new SquareAnnotation(parameters);
[54370] Fix | Delete
case "Circle":
[54371] Fix | Delete
return new CircleAnnotation(parameters);
[54372] Fix | Delete
case "PolyLine":
[54373] Fix | Delete
return new PolylineAnnotation(parameters);
[54374] Fix | Delete
case "Polygon":
[54375] Fix | Delete
return new PolygonAnnotation(parameters);
[54376] Fix | Delete
case "Caret":
[54377] Fix | Delete
return new CaretAnnotation(parameters);
[54378] Fix | Delete
case "Ink":
[54379] Fix | Delete
return new InkAnnotation(parameters);
[54380] Fix | Delete
case "Highlight":
[54381] Fix | Delete
return new HighlightAnnotation(parameters);
[54382] Fix | Delete
case "Underline":
[54383] Fix | Delete
return new UnderlineAnnotation(parameters);
[54384] Fix | Delete
case "Squiggly":
[54385] Fix | Delete
return new SquigglyAnnotation(parameters);
[54386] Fix | Delete
case "StrikeOut":
[54387] Fix | Delete
return new StrikeOutAnnotation(parameters);
[54388] Fix | Delete
case "Stamp":
[54389] Fix | Delete
return new StampAnnotation(parameters);
[54390] Fix | Delete
case "FileAttachment":
[54391] Fix | Delete
return new FileAttachmentAnnotation(parameters);
[54392] Fix | Delete
default:
[54393] Fix | Delete
if (!collectFields) {
[54394] Fix | Delete
if (!subtype) {
[54395] Fix | Delete
warn("Annotation is missing the required /Subtype.");
[54396] Fix | Delete
} else {
[54397] Fix | Delete
warn(`Unimplemented annotation type "${subtype}", ` + "falling back to base annotation.");
[54398] Fix | Delete
}
[54399] Fix | Delete
}
[54400] Fix | Delete
return new Annotation(parameters);
[54401] Fix | Delete
}
[54402] Fix | Delete
}
[54403] Fix | Delete
static async _getPageIndex(xref, ref, pdfManager) {
[54404] Fix | Delete
try {
[54405] Fix | Delete
const annotDict = await xref.fetchIfRefAsync(ref);
[54406] Fix | Delete
if (!(annotDict instanceof Dict)) {
[54407] Fix | Delete
return -1;
[54408] Fix | Delete
}
[54409] Fix | Delete
const pageRef = annotDict.getRaw("P");
[54410] Fix | Delete
if (pageRef instanceof Ref) {
[54411] Fix | Delete
try {
[54412] Fix | Delete
const pageIndex = await pdfManager.ensureCatalog("getPageIndex", [pageRef]);
[54413] Fix | Delete
return pageIndex;
[54414] Fix | Delete
} catch (ex) {
[54415] Fix | Delete
info(`_getPageIndex -- not a valid page reference: "${ex}".`);
[54416] Fix | Delete
}
[54417] Fix | Delete
}
[54418] Fix | Delete
if (annotDict.has("Kids")) {
[54419] Fix | Delete
return -1;
[54420] Fix | Delete
}
[54421] Fix | Delete
const numPages = await pdfManager.ensureDoc("numPages");
[54422] Fix | Delete
for (let pageIndex = 0; pageIndex < numPages; pageIndex++) {
[54423] Fix | Delete
const page = await pdfManager.getPage(pageIndex);
[54424] Fix | Delete
const annotations = await pdfManager.ensure(page, "annotations");
[54425] Fix | Delete
for (const annotRef of annotations) {
[54426] Fix | Delete
if (annotRef instanceof Ref && isRefsEqual(annotRef, ref)) {
[54427] Fix | Delete
return pageIndex;
[54428] Fix | Delete
}
[54429] Fix | Delete
}
[54430] Fix | Delete
}
[54431] Fix | Delete
} catch (ex) {
[54432] Fix | Delete
warn(`_getPageIndex: "${ex}".`);
[54433] Fix | Delete
}
[54434] Fix | Delete
return -1;
[54435] Fix | Delete
}
[54436] Fix | Delete
static generateImages(annotations, xref, isOffscreenCanvasSupported) {
[54437] Fix | Delete
if (!isOffscreenCanvasSupported) {
[54438] Fix | Delete
warn("generateImages: OffscreenCanvas is not supported, cannot save or print some annotations with images.");
[54439] Fix | Delete
return null;
[54440] Fix | Delete
}
[54441] Fix | Delete
let imagePromises;
[54442] Fix | Delete
for (const {
[54443] Fix | Delete
bitmapId,
[54444] Fix | Delete
bitmap
[54445] Fix | Delete
} of annotations) {
[54446] Fix | Delete
if (!bitmap) {
[54447] Fix | Delete
continue;
[54448] Fix | Delete
}
[54449] Fix | Delete
imagePromises ||= new Map();
[54450] Fix | Delete
imagePromises.set(bitmapId, StampAnnotation.createImage(bitmap, xref));
[54451] Fix | Delete
}
[54452] Fix | Delete
return imagePromises;
[54453] Fix | Delete
}
[54454] Fix | Delete
static async saveNewAnnotations(evaluator, task, annotations, imagePromises) {
[54455] Fix | Delete
const xref = evaluator.xref;
[54456] Fix | Delete
let baseFontRef;
[54457] Fix | Delete
const dependencies = [];
[54458] Fix | Delete
const promises = [];
[54459] Fix | Delete
const {
[54460] Fix | Delete
isOffscreenCanvasSupported
[54461] Fix | Delete
} = evaluator.options;
[54462] Fix | Delete
for (const annotation of annotations) {
[54463] Fix | Delete
if (annotation.deleted) {
[54464] Fix | Delete
continue;
[54465] Fix | Delete
}
[54466] Fix | Delete
switch (annotation.annotationType) {
[54467] Fix | Delete
case AnnotationEditorType.FREETEXT:
[54468] Fix | Delete
if (!baseFontRef) {
[54469] Fix | Delete
const baseFont = new Dict(xref);
[54470] Fix | Delete
baseFont.set("BaseFont", Name.get("Helvetica"));
[54471] Fix | Delete
baseFont.set("Type", Name.get("Font"));
[54472] Fix | Delete
baseFont.set("Subtype", Name.get("Type1"));
[54473] Fix | Delete
baseFont.set("Encoding", Name.get("WinAnsiEncoding"));
[54474] Fix | Delete
const buffer = [];
[54475] Fix | Delete
baseFontRef = xref.getNewTemporaryRef();
[54476] Fix | Delete
await writeObject(baseFontRef, baseFont, buffer, xref);
[54477] Fix | Delete
dependencies.push({
[54478] Fix | Delete
ref: baseFontRef,
[54479] Fix | Delete
data: buffer.join("")
[54480] Fix | Delete
});
[54481] Fix | Delete
}
[54482] Fix | Delete
promises.push(FreeTextAnnotation.createNewAnnotation(xref, annotation, dependencies, {
[54483] Fix | Delete
evaluator,
[54484] Fix | Delete
task,
[54485] Fix | Delete
baseFontRef
[54486] Fix | Delete
}));
[54487] Fix | Delete
break;
[54488] Fix | Delete
case AnnotationEditorType.HIGHLIGHT:
[54489] Fix | Delete
if (annotation.quadPoints) {
[54490] Fix | Delete
promises.push(HighlightAnnotation.createNewAnnotation(xref, annotation, dependencies));
[54491] Fix | Delete
} else {
[54492] Fix | Delete
promises.push(InkAnnotation.createNewAnnotation(xref, annotation, dependencies));
[54493] Fix | Delete
}
[54494] Fix | Delete
break;
[54495] Fix | Delete
case AnnotationEditorType.INK:
[54496] Fix | Delete
promises.push(InkAnnotation.createNewAnnotation(xref, annotation, dependencies));
[54497] Fix | Delete
break;
[54498] Fix | Delete
case AnnotationEditorType.STAMP:
[54499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function