java.lang.Iterable<PDPage>
, COSObjectable
public class PDPageTree extends java.lang.Object implements COSObjectable, java.lang.Iterable<PDPage>
Constructor | Description |
---|---|
PDPageTree() |
Constructor for embedding.
|
PDPageTree(COSDictionary root) |
Constructor for reading.
|
Modifier and Type | Method | Description |
---|---|---|
void |
add(PDPage page) |
Adds the given page to this page tree.
|
PDPage |
get(int index) |
Returns the page at the given index.
|
COSDictionary |
getCOSObject() |
Convert this standard java object to a COS object.
|
int |
getCount() |
Returns the number of leaf nodes (page objects) that are descendants of this root within the page tree.
|
static COSBase |
getInheritableAttribute(COSDictionary node,
COSName key) |
Returns the given attribute, inheriting from parent tree nodes if necessary.
|
int |
indexOf(PDPage page) |
Returns the index of the given page, or -1 if it does not exist.
|
void |
insertAfter(PDPage newPage,
PDPage prevPage) |
Insert a page after another page within a page tree.
|
void |
insertBefore(PDPage newPage,
PDPage nextPage) |
Insert a page before another page within a page tree.
|
java.util.Iterator<PDPage> |
iterator() |
Returns an iterator which walks all pages in the tree, in order.
|
void |
remove(int index) |
Removes the page with the given index from the page tree.
|
void |
remove(PDPage page) |
Removes the given page from the page tree.
|
public PDPageTree()
public PDPageTree(COSDictionary root)
root
- A page tree root.public static COSBase getInheritableAttribute(COSDictionary node, COSName key)
node
- page objectkey
- the key to look uppublic java.util.Iterator<PDPage> iterator()
iterator
in interface java.lang.Iterable<PDPage>
public PDPage get(int index)
index
- zero-based indexpublic int indexOf(PDPage page)
page
- The page to search for.public int getCount()
public COSDictionary getCOSObject()
COSObjectable
getCOSObject
in interface COSObjectable
public void remove(int index)
index
- zero-based page indexpublic void remove(PDPage page)
page
- The page to remove.public void add(PDPage page)
page
- The page to add.public void insertBefore(PDPage newPage, PDPage nextPage)
newPage
- the page to be inserted.nextPage
- the page that is to be after the new page.java.lang.IllegalArgumentException
- if one attempts to insert a page that isn't part of a page
tree.public void insertAfter(PDPage newPage, PDPage prevPage)
newPage
- the page to be inserted.prevPage
- the page that is to be before the new page.java.lang.IllegalArgumentException
- if one attempts to insert a page that isn't part of a page
tree.Copyright © 2002–2018. All rights reserved.