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 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 OutlineItem or
null
if out of range.- Returns:
OutlineItem
|null
.
EXAMPLE
var obj = outlineIterator.item();
- next()#
Move the iterator position to “next”.
- Returns:
number
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:
number
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:
number
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:
number
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: OutlineItem)#
Insert item before the current item. The position does not change.
- Parameters:
item – OutlineItem.
- Returns:
number
which is0
if the current position has a valid item, or1
if the position has no valid item.
EXAMPLE
var result = outlineIterator.insert(item);
- delete()#
Delete the current item. This implicitly moves to the next item.
- Returns:
number
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: OutlineItem)#
Updates the current item properties with values from the supplied item’s properties.
- Parameters:
item – OutlineItem.
EXAMPLE
outlineIterator.update(item);
Code samples
Code samples are in TypeScript and assume that the following requirements are defined in your TypeScript file header as follows:
import * as fs from "fs"
import * as mupdfjs from "mupdf/mupdfjs"