MCPcopy Create free account
hub / github.com/LibPDF-js/core / getAllObjects

Method getAllObjects

src/parser/object-stream-parser.ts:189–207  ·  view source on GitHub ↗

* Get all objects in this stream. * * @returns Map of object number → parsed object

()

Source from the content-addressed store, hash-verified

187 * @returns Map of object number → parsed object
188 */
189 getAllObjects(): Map<number, PdfObject> {
190 this.parse();
191
192 if (this.index === null) {
193 throw new ObjectParseError("Index not parsed");
194 }
195
196 const result = new Map<number, PdfObject>();
197
198 for (let i = 0; i < this.index.length; i++) {
199 const obj = this.getObject(i);
200
201 if (obj !== null) {
202 result.set(this.index[i].objNum, obj);
203 }
204 }
205
206 return result;
207 }
208
209 /**
210 * Get the object number at a given index.

Callers 1

Calls 3

parseMethod · 0.95
getObjectMethod · 0.95
setMethod · 0.45

Tested by

no test coverage detected