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.data.annotationType = AnnotationType.STRIKEOUT;
[57500] Fix | Delete
const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
[57501] Fix | Delete
if (quadPoints) {
[57502] Fix | Delete
if (!this.appearance) {
[57503] Fix | Delete
const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
[57504] Fix | Delete
const strokeAlpha = dict.get("CA");
[57505] Fix | Delete
this._setDefaultAppearance({
[57506] Fix | Delete
xref,
[57507] Fix | Delete
extra: "[] 0 d 1 w",
[57508] Fix | Delete
strokeColor,
[57509] Fix | Delete
strokeAlpha,
[57510] Fix | Delete
pointsCallback: (buffer, points) => {
[57511] Fix | Delete
buffer.push(`${(points[0].x + points[2].x) / 2} ` + `${(points[0].y + points[2].y) / 2} m`, `${(points[1].x + points[3].x) / 2} ` + `${(points[1].y + points[3].y) / 2} l`, "S");
[57512] Fix | Delete
return [points[0].x, points[1].x, points[3].y, points[1].y];
[57513] Fix | Delete
}
[57514] Fix | Delete
});
[57515] Fix | Delete
}
[57516] Fix | Delete
} else {
[57517] Fix | Delete
this.data.popupRef = null;
[57518] Fix | Delete
}
[57519] Fix | Delete
}
[57520] Fix | Delete
}
[57521] Fix | Delete
class StampAnnotation extends MarkupAnnotation {
[57522] Fix | Delete
constructor(params) {
[57523] Fix | Delete
super(params);
[57524] Fix | Delete
this.data.annotationType = AnnotationType.STAMP;
[57525] Fix | Delete
this.data.hasOwnCanvas = this.data.noRotate;
[57526] Fix | Delete
this.data.noHTML = false;
[57527] Fix | Delete
}
[57528] Fix | Delete
static async createImage(bitmap, xref) {
[57529] Fix | Delete
const {
[57530] Fix | Delete
width,
[57531] Fix | Delete
height
[57532] Fix | Delete
} = bitmap;
[57533] Fix | Delete
const canvas = new OffscreenCanvas(width, height);
[57534] Fix | Delete
const ctx = canvas.getContext("2d", {
[57535] Fix | Delete
alpha: true
[57536] Fix | Delete
});
[57537] Fix | Delete
ctx.drawImage(bitmap, 0, 0);
[57538] Fix | Delete
const data = ctx.getImageData(0, 0, width, height).data;
[57539] Fix | Delete
const buf32 = new Uint32Array(data.buffer);
[57540] Fix | Delete
const hasAlpha = buf32.some(FeatureTest.isLittleEndian ? x => x >>> 24 !== 0xff : x => (x & 0xff) !== 0xff);
[57541] Fix | Delete
if (hasAlpha) {
[57542] Fix | Delete
ctx.fillStyle = "white";
[57543] Fix | Delete
ctx.fillRect(0, 0, width, height);
[57544] Fix | Delete
ctx.drawImage(bitmap, 0, 0);
[57545] Fix | Delete
}
[57546] Fix | Delete
const jpegBufferPromise = canvas.convertToBlob({
[57547] Fix | Delete
type: "image/jpeg",
[57548] Fix | Delete
quality: 1
[57549] Fix | Delete
}).then(blob => blob.arrayBuffer());
[57550] Fix | Delete
const xobjectName = Name.get("XObject");
[57551] Fix | Delete
const imageName = Name.get("Image");
[57552] Fix | Delete
const image = new Dict(xref);
[57553] Fix | Delete
image.set("Type", xobjectName);
[57554] Fix | Delete
image.set("Subtype", imageName);
[57555] Fix | Delete
image.set("BitsPerComponent", 8);
[57556] Fix | Delete
image.set("ColorSpace", Name.get("DeviceRGB"));
[57557] Fix | Delete
image.set("Filter", Name.get("DCTDecode"));
[57558] Fix | Delete
image.set("BBox", [0, 0, width, height]);
[57559] Fix | Delete
image.set("Width", width);
[57560] Fix | Delete
image.set("Height", height);
[57561] Fix | Delete
let smaskStream = null;
[57562] Fix | Delete
if (hasAlpha) {
[57563] Fix | Delete
const alphaBuffer = new Uint8Array(buf32.length);
[57564] Fix | Delete
if (FeatureTest.isLittleEndian) {
[57565] Fix | Delete
for (let i = 0, ii = buf32.length; i < ii; i++) {
[57566] Fix | Delete
alphaBuffer[i] = buf32[i] >>> 24;
[57567] Fix | Delete
}
[57568] Fix | Delete
} else {
[57569] Fix | Delete
for (let i = 0, ii = buf32.length; i < ii; i++) {
[57570] Fix | Delete
alphaBuffer[i] = buf32[i] & 0xff;
[57571] Fix | Delete
}
[57572] Fix | Delete
}
[57573] Fix | Delete
const smask = new Dict(xref);
[57574] Fix | Delete
smask.set("Type", xobjectName);
[57575] Fix | Delete
smask.set("Subtype", imageName);
[57576] Fix | Delete
smask.set("BitsPerComponent", 8);
[57577] Fix | Delete
smask.set("ColorSpace", Name.get("DeviceGray"));
[57578] Fix | Delete
smask.set("Width", width);
[57579] Fix | Delete
smask.set("Height", height);
[57580] Fix | Delete
smaskStream = new Stream(alphaBuffer, 0, 0, smask);
[57581] Fix | Delete
}
[57582] Fix | Delete
const imageStream = new Stream(await jpegBufferPromise, 0, 0, image);
[57583] Fix | Delete
return {
[57584] Fix | Delete
imageStream,
[57585] Fix | Delete
smaskStream,
[57586] Fix | Delete
width,
[57587] Fix | Delete
height
[57588] Fix | Delete
};
[57589] Fix | Delete
}
[57590] Fix | Delete
static createNewDict(annotation, xref, {
[57591] Fix | Delete
apRef,
[57592] Fix | Delete
ap
[57593] Fix | Delete
}) {
[57594] Fix | Delete
const {
[57595] Fix | Delete
rect,
[57596] Fix | Delete
rotation,
[57597] Fix | Delete
user
[57598] Fix | Delete
} = annotation;
[57599] Fix | Delete
const stamp = new Dict(xref);
[57600] Fix | Delete
stamp.set("Type", Name.get("Annot"));
[57601] Fix | Delete
stamp.set("Subtype", Name.get("Stamp"));
[57602] Fix | Delete
stamp.set("CreationDate", `D:${getModificationDate()}`);
[57603] Fix | Delete
stamp.set("Rect", rect);
[57604] Fix | Delete
stamp.set("F", 4);
[57605] Fix | Delete
stamp.set("Border", [0, 0, 0]);
[57606] Fix | Delete
stamp.set("Rotate", rotation);
[57607] Fix | Delete
if (user) {
[57608] Fix | Delete
stamp.set("T", isAscii(user) ? user : stringToUTF16String(user, true));
[57609] Fix | Delete
}
[57610] Fix | Delete
if (apRef || ap) {
[57611] Fix | Delete
const n = new Dict(xref);
[57612] Fix | Delete
stamp.set("AP", n);
[57613] Fix | Delete
if (apRef) {
[57614] Fix | Delete
n.set("N", apRef);
[57615] Fix | Delete
} else {
[57616] Fix | Delete
n.set("N", ap);
[57617] Fix | Delete
}
[57618] Fix | Delete
}
[57619] Fix | Delete
return stamp;
[57620] Fix | Delete
}
[57621] Fix | Delete
static async createNewAppearanceStream(annotation, xref, params) {
[57622] Fix | Delete
const {
[57623] Fix | Delete
rotation
[57624] Fix | Delete
} = annotation;
[57625] Fix | Delete
const {
[57626] Fix | Delete
imageRef,
[57627] Fix | Delete
width,
[57628] Fix | Delete
height
[57629] Fix | Delete
} = params.image;
[57630] Fix | Delete
const resources = new Dict(xref);
[57631] Fix | Delete
const xobject = new Dict(xref);
[57632] Fix | Delete
resources.set("XObject", xobject);
[57633] Fix | Delete
xobject.set("Im0", imageRef);
[57634] Fix | Delete
const appearance = `q ${width} 0 0 ${height} 0 0 cm /Im0 Do Q`;
[57635] Fix | Delete
const appearanceStreamDict = new Dict(xref);
[57636] Fix | Delete
appearanceStreamDict.set("FormType", 1);
[57637] Fix | Delete
appearanceStreamDict.set("Subtype", Name.get("Form"));
[57638] Fix | Delete
appearanceStreamDict.set("Type", Name.get("XObject"));
[57639] Fix | Delete
appearanceStreamDict.set("BBox", [0, 0, width, height]);
[57640] Fix | Delete
appearanceStreamDict.set("Resources", resources);
[57641] Fix | Delete
if (rotation) {
[57642] Fix | Delete
const matrix = getRotationMatrix(rotation, width, height);
[57643] Fix | Delete
appearanceStreamDict.set("Matrix", matrix);
[57644] Fix | Delete
}
[57645] Fix | Delete
const ap = new StringStream(appearance);
[57646] Fix | Delete
ap.dict = appearanceStreamDict;
[57647] Fix | Delete
return ap;
[57648] Fix | Delete
}
[57649] Fix | Delete
}
[57650] Fix | Delete
class FileAttachmentAnnotation extends MarkupAnnotation {
[57651] Fix | Delete
constructor(params) {
[57652] Fix | Delete
super(params);
[57653] Fix | Delete
const {
[57654] Fix | Delete
dict,
[57655] Fix | Delete
xref
[57656] Fix | Delete
} = params;
[57657] Fix | Delete
const file = new FileSpec(dict.get("FS"), xref);
[57658] Fix | Delete
this.data.annotationType = AnnotationType.FILEATTACHMENT;
[57659] Fix | Delete
this.data.hasOwnCanvas = this.data.noRotate;
[57660] Fix | Delete
this.data.noHTML = false;
[57661] Fix | Delete
this.data.file = file.serializable;
[57662] Fix | Delete
const name = dict.get("Name");
[57663] Fix | Delete
this.data.name = name instanceof Name ? stringToPDFString(name.name) : "PushPin";
[57664] Fix | Delete
const fillAlpha = dict.get("ca");
[57665] Fix | Delete
this.data.fillAlpha = typeof fillAlpha === "number" && fillAlpha >= 0 && fillAlpha <= 1 ? fillAlpha : null;
[57666] Fix | Delete
}
[57667] Fix | Delete
}
[57668] Fix | Delete
[57669] Fix | Delete
;// CONCATENATED MODULE: ./src/core/dataset_reader.js
[57670] Fix | Delete
[57671] Fix | Delete
[57672] Fix | Delete
[57673] Fix | Delete
[57674] Fix | Delete
function decodeString(str) {
[57675] Fix | Delete
try {
[57676] Fix | Delete
return stringToUTF8String(str);
[57677] Fix | Delete
} catch (ex) {
[57678] Fix | Delete
warn(`UTF-8 decoding failed: "${ex}".`);
[57679] Fix | Delete
return str;
[57680] Fix | Delete
}
[57681] Fix | Delete
}
[57682] Fix | Delete
class DatasetXMLParser extends SimpleXMLParser {
[57683] Fix | Delete
constructor(options) {
[57684] Fix | Delete
super(options);
[57685] Fix | Delete
this.node = null;
[57686] Fix | Delete
}
[57687] Fix | Delete
onEndElement(name) {
[57688] Fix | Delete
const node = super.onEndElement(name);
[57689] Fix | Delete
if (node && name === "xfa:datasets") {
[57690] Fix | Delete
this.node = node;
[57691] Fix | Delete
throw new Error("Aborting DatasetXMLParser.");
[57692] Fix | Delete
}
[57693] Fix | Delete
}
[57694] Fix | Delete
}
[57695] Fix | Delete
class DatasetReader {
[57696] Fix | Delete
constructor(data) {
[57697] Fix | Delete
if (data.datasets) {
[57698] Fix | Delete
this.node = new SimpleXMLParser({
[57699] Fix | Delete
hasAttributes: true
[57700] Fix | Delete
}).parseFromString(data.datasets).documentElement;
[57701] Fix | Delete
} else {
[57702] Fix | Delete
const parser = new DatasetXMLParser({
[57703] Fix | Delete
hasAttributes: true
[57704] Fix | Delete
});
[57705] Fix | Delete
try {
[57706] Fix | Delete
parser.parseFromString(data["xdp:xdp"]);
[57707] Fix | Delete
} catch {}
[57708] Fix | Delete
this.node = parser.node;
[57709] Fix | Delete
}
[57710] Fix | Delete
}
[57711] Fix | Delete
getValue(path) {
[57712] Fix | Delete
if (!this.node || !path) {
[57713] Fix | Delete
return "";
[57714] Fix | Delete
}
[57715] Fix | Delete
const node = this.node.searchNode(parseXFAPath(path), 0);
[57716] Fix | Delete
if (!node) {
[57717] Fix | Delete
return "";
[57718] Fix | Delete
}
[57719] Fix | Delete
const first = node.firstChild;
[57720] Fix | Delete
if (first?.nodeName === "value") {
[57721] Fix | Delete
return node.children.map(child => decodeString(child.textContent));
[57722] Fix | Delete
}
[57723] Fix | Delete
return decodeString(node.textContent);
[57724] Fix | Delete
}
[57725] Fix | Delete
}
[57726] Fix | Delete
[57727] Fix | Delete
;// CONCATENATED MODULE: ./src/core/xref.js
[57728] Fix | Delete
[57729] Fix | Delete
[57730] Fix | Delete
[57731] Fix | Delete
[57732] Fix | Delete
[57733] Fix | Delete
[57734] Fix | Delete
[57735] Fix | Delete
[57736] Fix | Delete
[57737] Fix | Delete
[57738] Fix | Delete
[57739] Fix | Delete
[57740] Fix | Delete
[57741] Fix | Delete
[57742] Fix | Delete
[57743] Fix | Delete
[57744] Fix | Delete
[57745] Fix | Delete
[57746] Fix | Delete
[57747] Fix | Delete
[57748] Fix | Delete
class XRef {
[57749] Fix | Delete
#firstXRefStmPos = null;
[57750] Fix | Delete
constructor(stream, pdfManager) {
[57751] Fix | Delete
this.stream = stream;
[57752] Fix | Delete
this.pdfManager = pdfManager;
[57753] Fix | Delete
this.entries = [];
[57754] Fix | Delete
this._xrefStms = new Set();
[57755] Fix | Delete
this._cacheMap = new Map();
[57756] Fix | Delete
this._pendingRefs = new RefSet();
[57757] Fix | Delete
this._newPersistentRefNum = null;
[57758] Fix | Delete
this._newTemporaryRefNum = null;
[57759] Fix | Delete
this._persistentRefsCache = null;
[57760] Fix | Delete
}
[57761] Fix | Delete
getNewPersistentRef(obj) {
[57762] Fix | Delete
if (this._newPersistentRefNum === null) {
[57763] Fix | Delete
this._newPersistentRefNum = this.entries.length || 1;
[57764] Fix | Delete
}
[57765] Fix | Delete
const num = this._newPersistentRefNum++;
[57766] Fix | Delete
this._cacheMap.set(num, obj);
[57767] Fix | Delete
return Ref.get(num, 0);
[57768] Fix | Delete
}
[57769] Fix | Delete
getNewTemporaryRef() {
[57770] Fix | Delete
if (this._newTemporaryRefNum === null) {
[57771] Fix | Delete
this._newTemporaryRefNum = this.entries.length || 1;
[57772] Fix | Delete
if (this._newPersistentRefNum) {
[57773] Fix | Delete
this._persistentRefsCache = new Map();
[57774] Fix | Delete
for (let i = this._newTemporaryRefNum; i < this._newPersistentRefNum; i++) {
[57775] Fix | Delete
this._persistentRefsCache.set(i, this._cacheMap.get(i));
[57776] Fix | Delete
this._cacheMap.delete(i);
[57777] Fix | Delete
}
[57778] Fix | Delete
}
[57779] Fix | Delete
}
[57780] Fix | Delete
return Ref.get(this._newTemporaryRefNum++, 0);
[57781] Fix | Delete
}
[57782] Fix | Delete
resetNewTemporaryRef() {
[57783] Fix | Delete
this._newTemporaryRefNum = null;
[57784] Fix | Delete
if (this._persistentRefsCache) {
[57785] Fix | Delete
for (const [num, obj] of this._persistentRefsCache) {
[57786] Fix | Delete
this._cacheMap.set(num, obj);
[57787] Fix | Delete
}
[57788] Fix | Delete
}
[57789] Fix | Delete
this._persistentRefsCache = null;
[57790] Fix | Delete
}
[57791] Fix | Delete
setStartXRef(startXRef) {
[57792] Fix | Delete
this.startXRefQueue = [startXRef];
[57793] Fix | Delete
}
[57794] Fix | Delete
parse(recoveryMode = false) {
[57795] Fix | Delete
let trailerDict;
[57796] Fix | Delete
if (!recoveryMode) {
[57797] Fix | Delete
trailerDict = this.readXRef();
[57798] Fix | Delete
} else {
[57799] Fix | Delete
warn("Indexing all PDF objects");
[57800] Fix | Delete
trailerDict = this.indexObjects();
[57801] Fix | Delete
}
[57802] Fix | Delete
trailerDict.assignXref(this);
[57803] Fix | Delete
this.trailer = trailerDict;
[57804] Fix | Delete
let encrypt;
[57805] Fix | Delete
try {
[57806] Fix | Delete
encrypt = trailerDict.get("Encrypt");
[57807] Fix | Delete
} catch (ex) {
[57808] Fix | Delete
if (ex instanceof MissingDataException) {
[57809] Fix | Delete
throw ex;
[57810] Fix | Delete
}
[57811] Fix | Delete
warn(`XRef.parse - Invalid "Encrypt" reference: "${ex}".`);
[57812] Fix | Delete
}
[57813] Fix | Delete
if (encrypt instanceof Dict) {
[57814] Fix | Delete
const ids = trailerDict.get("ID");
[57815] Fix | Delete
const fileId = ids?.length ? ids[0] : "";
[57816] Fix | Delete
encrypt.suppressEncryption = true;
[57817] Fix | Delete
this.encrypt = new CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
[57818] Fix | Delete
}
[57819] Fix | Delete
let root;
[57820] Fix | Delete
try {
[57821] Fix | Delete
root = trailerDict.get("Root");
[57822] Fix | Delete
} catch (ex) {
[57823] Fix | Delete
if (ex instanceof MissingDataException) {
[57824] Fix | Delete
throw ex;
[57825] Fix | Delete
}
[57826] Fix | Delete
warn(`XRef.parse - Invalid "Root" reference: "${ex}".`);
[57827] Fix | Delete
}
[57828] Fix | Delete
if (root instanceof Dict) {
[57829] Fix | Delete
try {
[57830] Fix | Delete
const pages = root.get("Pages");
[57831] Fix | Delete
if (pages instanceof Dict) {
[57832] Fix | Delete
this.root = root;
[57833] Fix | Delete
return;
[57834] Fix | Delete
}
[57835] Fix | Delete
} catch (ex) {
[57836] Fix | Delete
if (ex instanceof MissingDataException) {
[57837] Fix | Delete
throw ex;
[57838] Fix | Delete
}
[57839] Fix | Delete
warn(`XRef.parse - Invalid "Pages" reference: "${ex}".`);
[57840] Fix | Delete
}
[57841] Fix | Delete
}
[57842] Fix | Delete
if (!recoveryMode) {
[57843] Fix | Delete
throw new XRefParseException();
[57844] Fix | Delete
}
[57845] Fix | Delete
throw new InvalidPDFException("Invalid Root reference.");
[57846] Fix | Delete
}
[57847] Fix | Delete
processXRefTable(parser) {
[57848] Fix | Delete
if (!("tableState" in this)) {
[57849] Fix | Delete
this.tableState = {
[57850] Fix | Delete
entryNum: 0,
[57851] Fix | Delete
streamPos: parser.lexer.stream.pos,
[57852] Fix | Delete
parserBuf1: parser.buf1,
[57853] Fix | Delete
parserBuf2: parser.buf2
[57854] Fix | Delete
};
[57855] Fix | Delete
}
[57856] Fix | Delete
const obj = this.readXRefTable(parser);
[57857] Fix | Delete
if (!isCmd(obj, "trailer")) {
[57858] Fix | Delete
throw new FormatError("Invalid XRef table: could not find trailer dictionary");
[57859] Fix | Delete
}
[57860] Fix | Delete
let dict = parser.getObj();
[57861] Fix | Delete
if (!(dict instanceof Dict) && dict.dict) {
[57862] Fix | Delete
dict = dict.dict;
[57863] Fix | Delete
}
[57864] Fix | Delete
if (!(dict instanceof Dict)) {
[57865] Fix | Delete
throw new FormatError("Invalid XRef table: could not parse trailer dictionary");
[57866] Fix | Delete
}
[57867] Fix | Delete
delete this.tableState;
[57868] Fix | Delete
return dict;
[57869] Fix | Delete
}
[57870] Fix | Delete
readXRefTable(parser) {
[57871] Fix | Delete
const stream = parser.lexer.stream;
[57872] Fix | Delete
const tableState = this.tableState;
[57873] Fix | Delete
stream.pos = tableState.streamPos;
[57874] Fix | Delete
parser.buf1 = tableState.parserBuf1;
[57875] Fix | Delete
parser.buf2 = tableState.parserBuf2;
[57876] Fix | Delete
let obj;
[57877] Fix | Delete
while (true) {
[57878] Fix | Delete
if (!("firstEntryNum" in tableState) || !("entryCount" in tableState)) {
[57879] Fix | Delete
if (isCmd(obj = parser.getObj(), "trailer")) {
[57880] Fix | Delete
break;
[57881] Fix | Delete
}
[57882] Fix | Delete
tableState.firstEntryNum = obj;
[57883] Fix | Delete
tableState.entryCount = parser.getObj();
[57884] Fix | Delete
}
[57885] Fix | Delete
let first = tableState.firstEntryNum;
[57886] Fix | Delete
const count = tableState.entryCount;
[57887] Fix | Delete
if (!Number.isInteger(first) || !Number.isInteger(count)) {
[57888] Fix | Delete
throw new FormatError("Invalid XRef table: wrong types in subsection header");
[57889] Fix | Delete
}
[57890] Fix | Delete
for (let i = tableState.entryNum; i < count; i++) {
[57891] Fix | Delete
tableState.streamPos = stream.pos;
[57892] Fix | Delete
tableState.entryNum = i;
[57893] Fix | Delete
tableState.parserBuf1 = parser.buf1;
[57894] Fix | Delete
tableState.parserBuf2 = parser.buf2;
[57895] Fix | Delete
const entry = {};
[57896] Fix | Delete
entry.offset = parser.getObj();
[57897] Fix | Delete
entry.gen = parser.getObj();
[57898] Fix | Delete
const type = parser.getObj();
[57899] Fix | Delete
if (type instanceof Cmd) {
[57900] Fix | Delete
switch (type.cmd) {
[57901] Fix | Delete
case "f":
[57902] Fix | Delete
entry.free = true;
[57903] Fix | Delete
break;
[57904] Fix | Delete
case "n":
[57905] Fix | Delete
entry.uncompressed = true;
[57906] Fix | Delete
break;
[57907] Fix | Delete
}
[57908] Fix | Delete
}
[57909] Fix | Delete
if (!Number.isInteger(entry.offset) || !Number.isInteger(entry.gen) || !(entry.free || entry.uncompressed)) {
[57910] Fix | Delete
throw new FormatError(`Invalid entry in XRef subsection: ${first}, ${count}`);
[57911] Fix | Delete
}
[57912] Fix | Delete
if (i === 0 && entry.free && first === 1) {
[57913] Fix | Delete
first = 0;
[57914] Fix | Delete
}
[57915] Fix | Delete
if (!this.entries[i + first]) {
[57916] Fix | Delete
this.entries[i + first] = entry;
[57917] Fix | Delete
}
[57918] Fix | Delete
}
[57919] Fix | Delete
tableState.entryNum = 0;
[57920] Fix | Delete
tableState.streamPos = stream.pos;
[57921] Fix | Delete
tableState.parserBuf1 = parser.buf1;
[57922] Fix | Delete
tableState.parserBuf2 = parser.buf2;
[57923] Fix | Delete
delete tableState.firstEntryNum;
[57924] Fix | Delete
delete tableState.entryCount;
[57925] Fix | Delete
}
[57926] Fix | Delete
if (this.entries[0] && !this.entries[0].free) {
[57927] Fix | Delete
throw new FormatError("Invalid XRef table: unexpected first object");
[57928] Fix | Delete
}
[57929] Fix | Delete
return obj;
[57930] Fix | Delete
}
[57931] Fix | Delete
processXRefStream(stream) {
[57932] Fix | Delete
if (!("streamState" in this)) {
[57933] Fix | Delete
const streamParameters = stream.dict;
[57934] Fix | Delete
const byteWidths = streamParameters.get("W");
[57935] Fix | Delete
let range = streamParameters.get("Index");
[57936] Fix | Delete
if (!range) {
[57937] Fix | Delete
range = [0, streamParameters.get("Size")];
[57938] Fix | Delete
}
[57939] Fix | Delete
this.streamState = {
[57940] Fix | Delete
entryRanges: range,
[57941] Fix | Delete
byteWidths,
[57942] Fix | Delete
entryNum: 0,
[57943] Fix | Delete
streamPos: stream.pos
[57944] Fix | Delete
};
[57945] Fix | Delete
}
[57946] Fix | Delete
this.readXRefStream(stream);
[57947] Fix | Delete
delete this.streamState;
[57948] Fix | Delete
return stream.dict;
[57949] Fix | Delete
}
[57950] Fix | Delete
readXRefStream(stream) {
[57951] Fix | Delete
const streamState = this.streamState;
[57952] Fix | Delete
stream.pos = streamState.streamPos;
[57953] Fix | Delete
const [typeFieldWidth, offsetFieldWidth, generationFieldWidth] = streamState.byteWidths;
[57954] Fix | Delete
const entryRanges = streamState.entryRanges;
[57955] Fix | Delete
while (entryRanges.length > 0) {
[57956] Fix | Delete
const [first, n] = entryRanges;
[57957] Fix | Delete
if (!Number.isInteger(first) || !Number.isInteger(n)) {
[57958] Fix | Delete
throw new FormatError(`Invalid XRef range fields: ${first}, ${n}`);
[57959] Fix | Delete
}
[57960] Fix | Delete
if (!Number.isInteger(typeFieldWidth) || !Number.isInteger(offsetFieldWidth) || !Number.isInteger(generationFieldWidth)) {
[57961] Fix | Delete
throw new FormatError(`Invalid XRef entry fields length: ${first}, ${n}`);
[57962] Fix | Delete
}
[57963] Fix | Delete
for (let i = streamState.entryNum; i < n; ++i) {
[57964] Fix | Delete
streamState.entryNum = i;
[57965] Fix | Delete
streamState.streamPos = stream.pos;
[57966] Fix | Delete
let type = 0,
[57967] Fix | Delete
offset = 0,
[57968] Fix | Delete
generation = 0;
[57969] Fix | Delete
for (let j = 0; j < typeFieldWidth; ++j) {
[57970] Fix | Delete
const typeByte = stream.getByte();
[57971] Fix | Delete
if (typeByte === -1) {
[57972] Fix | Delete
throw new FormatError("Invalid XRef byteWidths 'type'.");
[57973] Fix | Delete
}
[57974] Fix | Delete
type = type << 8 | typeByte;
[57975] Fix | Delete
}
[57976] Fix | Delete
if (typeFieldWidth === 0) {
[57977] Fix | Delete
type = 1;
[57978] Fix | Delete
}
[57979] Fix | Delete
for (let j = 0; j < offsetFieldWidth; ++j) {
[57980] Fix | Delete
const offsetByte = stream.getByte();
[57981] Fix | Delete
if (offsetByte === -1) {
[57982] Fix | Delete
throw new FormatError("Invalid XRef byteWidths 'offset'.");
[57983] Fix | Delete
}
[57984] Fix | Delete
offset = offset << 8 | offsetByte;
[57985] Fix | Delete
}
[57986] Fix | Delete
for (let j = 0; j < generationFieldWidth; ++j) {
[57987] Fix | Delete
const generationByte = stream.getByte();
[57988] Fix | Delete
if (generationByte === -1) {
[57989] Fix | Delete
throw new FormatError("Invalid XRef byteWidths 'generation'.");
[57990] Fix | Delete
}
[57991] Fix | Delete
generation = generation << 8 | generationByte;
[57992] Fix | Delete
}
[57993] Fix | Delete
const entry = {};
[57994] Fix | Delete
entry.offset = offset;
[57995] Fix | Delete
entry.gen = generation;
[57996] Fix | Delete
switch (type) {
[57997] Fix | Delete
case 0:
[57998] Fix | Delete
entry.free = true;
[57999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function