happypdf / PDFObjectCopier
Class: PDFObjectCopier
Defined in: src/core/PDFObjectCopier.ts:31
PDFObjectCopier copies PDFObjects from a src context to a dest context. The primary use case for this is to copy pages between PDFs.
Copying an object with a PDFObjectCopier is different from cloning an object with its [[PDFObject.clone]] method:
const src: PDFContext = ...
const dest: PDFContext = ...
const originalObject: PDFObject = ...
const copiedObject = PDFObjectCopier.for(src, dest).copy(originalObject);
const clonedObject = originalObject.clone();Copying an object is equivalent to cloning it and then copying over any other objects that it references. Note that only dictionaries, arrays, and streams (or structures build from them) can contain indirect references to other objects. Copying a PDFObject that is not a dictionary, array, or stream is supported, but is equivalent to cloning it.
Methods
copy()
copy<T>(object): T;Defined in: src/core/PDFObjectCopier.ts:45
Type Parameters
| Type Parameter |
|---|
T extends PDFObject |
Parameters
| Parameter | Type |
|---|---|
object | T |
Returns
T
for()
static for(src, dest): PDFObjectCopier;Defined in: src/core/PDFObjectCopier.ts:32
Parameters
| Parameter | Type |
|---|---|
src | PDFContext |
dest | PDFContext |
Returns
PDFObjectCopier