Skip to content

happypdf / PDFPageTree

Class: PDFPageTree ​

Defined in: src/core/structures/PDFPageTree.ts:12

Extends ​

Constructors ​

Constructor ​

ts
protected new PDFPageTree(map, context): PDFPageTree;

Defined in: src/core/objects/PDFDict.ts:28

Parameters ​

ParameterType
mapDictMap
contextPDFContext

Returns ​

PDFPageTree

Inherited from ​

PDFDict.constructor

Properties ​

context ​

ts
readonly context: PDFContext;

Defined in: src/core/objects/PDFDict.ts:22

Inherited from ​

PDFDict.context


suppressEncryption ​

ts
suppressEncryption: boolean = false;

Defined in: src/core/objects/PDFDict.ts:26

Inherited from ​

PDFDict.suppressEncryption

Methods ​

ascend() ​

ts
ascend(visitor): void;

Defined in: src/core/structures/PDFPageTree.ts:152

Parameters ​

ParameterType
visitor(node) => any

Returns ​

void


asMap() ​

ts
asMap(): Map<PDFName, PDFObject>;

Defined in: src/core/objects/PDFDict.ts:162

Returns ​

Map&lt;PDFName, PDFObject&gt;

Inherited from ​

PDFDict.asMap


clone() ​

ts
clone(context?): PDFDict;

Defined in: src/core/objects/PDFDict.ts:176

Parameters ​

ParameterType
context?PDFContext

Returns ​

PDFDict

Inherited from ​

PDFDict.clone


copyBytesInto() ​

ts
copyBytesInto(buffer, offset): number;

Defined in: src/core/objects/PDFDict.ts:207

Parameters ​

ParameterType
bufferUint8Array
offsetnumber

Returns ​

number

Inherited from ​

PDFDict.copyBytesInto


Count() ​

ts
Count(): PDFNumber;

Defined in: src/core/structures/PDFPageTree.ts:33

Returns ​

PDFNumber


delete() ​

ts
delete(key): boolean;

Defined in: src/core/objects/PDFDict.ts:157

Parameters ​

ParameterType
keyPDFName

Returns ​

boolean

Inherited from ​

PDFDict.delete


entries() ​

ts
entries(): [PDFName, PDFObject][];

Defined in: src/core/objects/PDFDict.ts:42

Returns ​

[PDFName, PDFObject][]

Inherited from ​

PDFDict.entries


fromMapWithContext() ​

ts
static fromMapWithContext(map, context): PDFPageTree;

Defined in: src/core/structures/PDFPageTree.ts:22

Parameters ​

ParameterType
mapDictMap
contextPDFContext

Returns ​

PDFPageTree

Overrides ​

PDFDict.fromMapWithContext


get() ​

ts
get(key, preservePDFNull?): PDFObject | undefined;

Defined in: src/core/objects/PDFDict.ts:51

Parameters ​

ParameterTypeDefault value
keyPDFNameundefined
preservePDFNullbooleanfalse

Returns ​

PDFObject | undefined

Inherited from ​

PDFDict.get


has() ​

ts
has(key): boolean;

Defined in: src/core/objects/PDFDict.ts:62

Parameters ​

ParameterType
keyPDFName

Returns ​

boolean

Inherited from ​

PDFDict.has


insertLeafNode() ​

ts
insertLeafNode(leafRef, targetIndex): PDFRef | undefined;

Defined in: src/core/structures/PDFPageTree.ts:56

Inserts the given ref as a leaf node of this page tree at the specified index (zero-based). Also increments the Count of each page tree in the hierarchy to accomodate the new page.

Returns the ref of the PDFPageTree node into which leafRef was inserted, or undefined if it was inserted into the root node (the PDFPageTree upon which the method was first called).

Parameters ​

ParameterType
leafRefPDFRef
targetIndexnumber

Returns ​

PDFRef | undefined


keys() ​

ts
keys(): PDFName[];

Defined in: src/core/objects/PDFDict.ts:34

Returns ​

PDFName[]

Inherited from ​

PDFDict.keys


Kids() ​

ts
Kids(): PDFArray;

Defined in: src/core/structures/PDFPageTree.ts:29

Returns ​

PDFArray


lookup() ​

Call Signature ​

ts
lookup(key): PDFObject | undefined;

Defined in: src/core/objects/PDFDict.ts:113

Parameters ​
ParameterType
keyPDFName
Returns ​

PDFObject | undefined

Inherited from ​

PDFDict.lookup

Call Signature ​

ts
lookup(key, type): PDFArray;

Defined in: src/core/objects/PDFDict.ts:114

Parameters ​
ParameterType
keyPDFName
typetypeof PDFArray
Returns ​

PDFArray

Inherited from ​

PDFDict.lookup

Call Signature ​

ts
lookup(key, type): PDFBool;

Defined in: src/core/objects/PDFDict.ts:115

Parameters ​
ParameterType
keyPDFName
typetypeof PDFBool
Returns ​

PDFBool

Inherited from ​

PDFDict.lookup

Call Signature ​

ts
lookup(key, type): PDFDict;

Defined in: src/core/objects/PDFDict.ts:116

Parameters ​
ParameterType
keyPDFName
typetypeof PDFDict
Returns ​

PDFDict

Inherited from ​

PDFDict.lookup

Call Signature ​

ts
lookup(key, type): PDFHexString;

Defined in: src/core/objects/PDFDict.ts:117

Parameters ​
ParameterType
keyPDFName
typetypeof PDFHexString
Returns ​

PDFHexString

Inherited from ​

PDFDict.lookup

Call Signature ​

ts
lookup(key, type): PDFName;

Defined in: src/core/objects/PDFDict.ts:118

Parameters ​
ParameterType
keyPDFName
typetypeof PDFName
Returns ​

PDFName

Inherited from ​

PDFDict.lookup

Call Signature ​

ts
lookup(key, type): PDFNull;

Defined in: src/core/objects/PDFDict.ts:119

Parameters ​
ParameterType
keyPDFName
typePDFNull
Returns ​

PDFNull

Inherited from ​

PDFDict.lookup

Call Signature ​

ts
lookup(key, type): PDFNumber;

Defined in: src/core/objects/PDFDict.ts:120

Parameters ​
ParameterType
keyPDFName
typetypeof PDFNumber
Returns ​

PDFNumber

Inherited from ​

PDFDict.lookup

Call Signature ​

ts
lookup(key, type): PDFStream;

Defined in: src/core/objects/PDFDict.ts:121

Parameters ​
ParameterType
keyPDFName
typetypeof PDFStream
Returns ​

PDFStream

Inherited from ​

PDFDict.lookup

Call Signature ​

ts
lookup(key, type): PDFRef;

Defined in: src/core/objects/PDFDict.ts:122

Parameters ​
ParameterType
keyPDFName
typetypeof PDFRef
Returns ​

PDFRef

Inherited from ​

PDFDict.lookup

Call Signature ​

ts
lookup(key, type): PDFString;

Defined in: src/core/objects/PDFDict.ts:123

Parameters ​
ParameterType
keyPDFName
typetypeof PDFString
Returns ​

PDFString

Inherited from ​

PDFDict.lookup

Call Signature ​

ts
lookup(
   ref, 
   type1, 
   type2): PDFHexString | PDFString;

Defined in: src/core/objects/PDFDict.ts:124

Parameters ​
ParameterType
refPDFName
type1typeof PDFString
type2typeof PDFHexString
Returns ​

PDFHexString | PDFString

Inherited from ​

PDFDict.lookup

Call Signature ​

ts
lookup(
   ref, 
   type1, 
   type2): PDFStream | PDFDict;

Defined in: src/core/objects/PDFDict.ts:129

Parameters ​
ParameterType
refPDFName
type1typeof PDFDict
type2typeof PDFStream
Returns ​

PDFStream | PDFDict

Inherited from ​

PDFDict.lookup

Call Signature ​

ts
lookup(
   ref, 
   type1, 
   type2, 
   type3): 
  | PDFHexString
  | PDFString
  | PDFArray;

Defined in: src/core/objects/PDFDict.ts:134

Parameters ​
ParameterType
refPDFName
type1typeof PDFString
type2typeof PDFHexString
type3typeof PDFArray
Returns ​

| PDFHexString | PDFString | PDFArray

Inherited from ​

PDFDict.lookup


lookupMaybe() ​

Call Signature ​

ts
lookupMaybe(key, type): PDFArray | undefined;

Defined in: src/core/objects/PDFDict.ts:67

Parameters ​
ParameterType
keyPDFName
typetypeof PDFArray
Returns ​

PDFArray | undefined

Inherited from ​

PDFDict.lookupMaybe

Call Signature ​

ts
lookupMaybe(key, type): PDFBool | undefined;

Defined in: src/core/objects/PDFDict.ts:68

Parameters ​
ParameterType
keyPDFName
typetypeof PDFBool
Returns ​

PDFBool | undefined

Inherited from ​

PDFDict.lookupMaybe

Call Signature ​

ts
lookupMaybe(key, type): PDFDict | undefined;

Defined in: src/core/objects/PDFDict.ts:69

Parameters ​
ParameterType
keyPDFName
typetypeof PDFDict
Returns ​

PDFDict | undefined

Inherited from ​

PDFDict.lookupMaybe

Call Signature ​

ts
lookupMaybe(key, type): PDFHexString | undefined;

Defined in: src/core/objects/PDFDict.ts:70

Parameters ​
ParameterType
keyPDFName
typetypeof PDFHexString
Returns ​

PDFHexString | undefined

Inherited from ​

PDFDict.lookupMaybe

Call Signature ​

ts
lookupMaybe(key, type): PDFName | undefined;

Defined in: src/core/objects/PDFDict.ts:74

Parameters ​
ParameterType
keyPDFName
typetypeof PDFName
Returns ​

PDFName | undefined

Inherited from ​

PDFDict.lookupMaybe

Call Signature ​

ts
lookupMaybe(key, type): PDFNull | undefined;

Defined in: src/core/objects/PDFDict.ts:75

Parameters ​
ParameterType
keyPDFName
typePDFNull
Returns ​

PDFNull | undefined

Inherited from ​

PDFDict.lookupMaybe

Call Signature ​

ts
lookupMaybe(key, type): PDFNumber | undefined;

Defined in: src/core/objects/PDFDict.ts:76

Parameters ​
ParameterType
keyPDFName
typetypeof PDFNumber
Returns ​

PDFNumber | undefined

Inherited from ​

PDFDict.lookupMaybe

Call Signature ​

ts
lookupMaybe(key, type): PDFStream | undefined;

Defined in: src/core/objects/PDFDict.ts:77

Parameters ​
ParameterType
keyPDFName
typetypeof PDFStream
Returns ​

PDFStream | undefined

Inherited from ​

PDFDict.lookupMaybe

Call Signature ​

ts
lookupMaybe(key, type): PDFRef | undefined;

Defined in: src/core/objects/PDFDict.ts:78

Parameters ​
ParameterType
keyPDFName
typetypeof PDFRef
Returns ​

PDFRef | undefined

Inherited from ​

PDFDict.lookupMaybe

Call Signature ​

ts
lookupMaybe(key, type): PDFString | undefined;

Defined in: src/core/objects/PDFDict.ts:79

Parameters ​
ParameterType
keyPDFName
typetypeof PDFString
Returns ​

PDFString | undefined

Inherited from ​

PDFDict.lookupMaybe

Call Signature ​

ts
lookupMaybe(
   ref, 
   type1, 
   type2): 
  | PDFHexString
  | PDFString
  | undefined;

Defined in: src/core/objects/PDFDict.ts:80

Parameters ​
ParameterType
refPDFName
type1typeof PDFString
type2typeof PDFHexString
Returns ​

| PDFHexString | PDFString | undefined

Inherited from ​

PDFDict.lookupMaybe

Call Signature ​

ts
lookupMaybe(
   ref, 
   type1, 
   type2): PDFStream | PDFDict | undefined;

Defined in: src/core/objects/PDFDict.ts:85

Parameters ​
ParameterType
refPDFName
type1typeof PDFDict
type2typeof PDFStream
Returns ​

PDFStream | PDFDict | undefined

Inherited from ​

PDFDict.lookupMaybe

Call Signature ​

ts
lookupMaybe(
   ref, 
   type1, 
   type2, 
   type3): 
  | PDFHexString
  | PDFString
  | PDFArray
  | undefined;

Defined in: src/core/objects/PDFDict.ts:90

Parameters ​
ParameterType
refPDFName
type1typeof PDFString
type2typeof PDFHexString
type3typeof PDFArray
Returns ​

| PDFHexString | PDFString | PDFArray | undefined

Inherited from ​

PDFDict.lookupMaybe


Parent() ​

ts
Parent(): PDFPageTree | undefined;

Defined in: src/core/structures/PDFPageTree.ts:25

Returns ​

PDFPageTree | undefined


pushLeafNode() ​

ts
pushLeafNode(leafRef): void;

Defined in: src/core/structures/PDFPageTree.ts:42

Parameters ​

ParameterType
leafRefPDFRef

Returns ​

void


pushTreeNode() ​

ts
pushTreeNode(treeRef): void;

Defined in: src/core/structures/PDFPageTree.ts:37

Parameters ​

ParameterType
treeRefPDFRef

Returns ​

void


registerChange() ​

ts
registerChange(): void;

Defined in: src/core/objects/PDFDict.ts:229

Returns ​

void

Inherited from ​

PDFDict.registerChange


removeLeafNode() ​

ts
removeLeafNode(targetIndex, prune?): void;

Defined in: src/core/structures/PDFPageTree.ts:111

Removes the leaf node at the specified index (zero-based) from this page tree. Also decrements the Count of each page tree in the hierarchy to account for the removed page.

If prune is true, then intermediate tree nodes will be removed from the tree if they contain 0 children after the leaf node is removed.

Parameters ​

ParameterTypeDefault value
targetIndexnumberundefined
prunebooleantrue

Returns ​

void


set() ​

ts
set(key, value): void;

Defined in: src/core/objects/PDFDict.ts:46

Parameters ​

ParameterType
keyPDFName
valuePDFObject

Returns ​

void

Inherited from ​

PDFDict.set


sizeInBytes() ​

ts
sizeInBytes(): number;

Defined in: src/core/objects/PDFDict.ts:197

Returns ​

number

Inherited from ​

PDFDict.sizeInBytes


toString() ​

ts
toString(): string;

Defined in: src/core/objects/PDFDict.ts:186

Returns ​

string

Inherited from ​

PDFDict.toString


traverse() ​

ts
traverse(visitor): void;

Defined in: src/core/structures/PDFPageTree.ts:159

Performs a Post-Order traversal of this page tree

Parameters ​

ParameterType
visitor(node, ref) => any

Returns ​

void


uniqueKey() ​

ts
uniqueKey(tag?): PDFName;

Defined in: src/core/objects/PDFDict.ts:167

Generate a random key that doesn't exist in current key set

Parameters ​

ParameterTypeDefault value
tagstring''

Returns ​

PDFName

Inherited from ​

PDFDict.uniqueKey


values() ​

ts
values(): PDFObject[];

Defined in: src/core/objects/PDFDict.ts:38

Returns ​

PDFObject[]

Inherited from ​

PDFDict.values


withContext() ​

ts
static withContext(context, parent?): PDFPageTree;

Defined in: src/core/structures/PDFPageTree.ts:13

Parameters ​

ParameterType
contextPDFContext
parent?PDFRef

Returns ​

PDFPageTree

Overrides ​

PDFDict.withContext

MIT Licensed. A fork of pdf-lib.