OutlineIterator
¶
An outline iterator can be used to walk over all the items in an Outline and query their properties. To be able to insert items at the end of a list of sibling items, it can also walk one item past the end of the list. To get an instance of OutlineIterator
use Document outlineIterator.
Note
In the context of a PDF file, the document’s Outline is also known as Table of Contents or Bookmarks.
Instance methods
- item()¶
Return an Outline Iterator Object or
undefined
if out of range.- Returns:
Object
.
EXAMPLE
var obj = outlineIterator.item();
- next()¶
Move the iterator position to “next”.
- Returns:
Int
which is negative if this movement is not possible,0
if the new position has a valid item, or1
if the new position has no item but one can be inserted here.
EXAMPLE
var result = outlineIterator.next();
- prev()¶
Move the iterator position to “previous”.
- Returns:
Int
which is negative if this movement is not possible,0
if the new position has a valid item, or1
if the new position has no item but one can be inserted here.
EXAMPLE
var result = outlineIterator.prev();
- up()¶
Move the iterator position “up”.
- Returns:
Int
which is negative if this movement is not possible,0
if the new position has a valid item, or1
if the new position has no item but one can be inserted here.
EXAMPLE
var result = outlineIterator.up();
- down()¶
Move the iterator position “down”.
- Returns:
Int
which is negative if this movement is not possible,0
if the new position has a valid item, or1
if the new position has no item but one can be inserted here.
EXAMPLE
var result = outlineIterator.down();
- insert(item)¶
Insert item before the current item. The position does not change.
- Arguments:
item –
Object
which conforms to the Outline Iterator Object.
- Returns:
Int
which is0
if the current position has a valid item, or1
if the position has no valid item.
EXAMPLE
var valid = outlineIterator.insert(item);
- delete()¶
Delete the current item. This implicitly moves to the next item.
- Returns:
Int
which is0
if the new position has a valid item, or1
if the position contains no valid item, but one may be inserted at this position.
EXAMPLE
outlineIterator.delete();
- update(item)¶
Updates the current item properties with values from the supplied item’s properties.
- Arguments:
item –
Object
which conforms to the Outline Iterator Object.
EXAMPLE
outlineIterator.update(item);