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

Method copyDictRef

src/document/object-copier.ts:231–243  ·  view source on GitHub ↗

* Copy a dict reference, handling circular references.

(key: string, srcDict: PdfDict)

Source from the content-addressed store, hash-verified

229 * Copy a dict reference, handling circular references.
230 */
231 private copyDictRef(key: string, srcDict: PdfDict): PdfRef {
232 // Clone the dict shell first
233 const cloned = srcDict.clone();
234
235 // Register immediately so back-references work
236 const destRef = this.dest.register(cloned);
237 this.refMap.set(key, destRef);
238
239 // Now copy all values (which may reference back to us)
240 this.copyDictValues(cloned);
241
242 return destRef;
243 }
244
245 /**
246 * Copy a stream reference, handling circular references and encryption.

Callers 1

copyRefMethod · 0.95

Calls 4

copyDictValuesMethod · 0.95
cloneMethod · 0.45
registerMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected