setasign\SetaPDF2\Core\Document
OutlinesItem Class representing an outline item
File: /SetaPDF v2/Core/Document/OutlinesItem.php
Old class name (alias):
\SetaPDF_Core_Document_OutlinesItem
Class hierarchy
Implements
Summary
Methods
- __construct()
- __clone()
- _isFlagSet()
- _setFlag()
- _updateParentCount()
- append()
- appendChild()
- appendChildCopy()
- appendCopy()
- close()
- contains()
- current()
- getAction()
- getChildren()
- getColor()
- getCount()
- getDestination()
- getDictionary()
- getFirstItem()
- getIndirectReference()
- getLastItem()
- getNext()
- getParent()
- getPrevious()
- getReferenceTo()
- getTitle()
- hasChildren()
- hasFirstItem()
- isBold()
- isItalic()
- isOpen()
- key()
- move()
- next()
- offsetExists()
- offsetGet()
- offsetSet()
- offsetUnset()
- open()
- prepend()
- prependCopy()
- remove()
- rewind()
- setAction()
- setBold()
- setColor()
- setDestination()
- setItalic()
- setOpen()
- setTitle()
- valid()
Constants
ACTION
Configuration key
APPEND_MODE_COPY
Append mode value
APPEND_MODE_MOVE
Append mode value
APPEND_MODE_NONE
Append mode value
BOLD
Configuration key
COLOR
Configuration key
DEST
Configuration key
ITALIC
Configuration key
MOVE_MODE_APPEND
Move mode value
MOVE_MODE_APPEND_CHILD
Move mode value
MOVE_MODE_PREPEND
Move mode value
TITLE
Configuration key
Properties
$_current
The current iterator item
Static Methods
_getHash()
copyItem()
Copies an item.
This method internally removes all relations to its parents or neighboring items.
Parameters
- $document : \SetaPDF_Core_Document
The document instance in which context the item will be copied
- $item : \SetaPDF_Core_Document_OutlinesItem
The item to copy
Exceptions
create()
Creates an outline item.
The configuration array could hold keyed values:
$config = array( \SetaPDF_Core_Document_OutlinesItem::TITLE => string, \SetaPDF_Core_Document_OutlinesItem::DEST => \SetaPDF_Core_Document_Destination|\SetaPDF_Core_Type_Array|string, \SetaPDF_Core_Document_OutlinesItem::ACTION => \SetaPDF_Core_Document_Action|\SetaPDF_Core_Type_Dictionary, \SetaPDF_Core_Document_OutlinesItem::COLOR => \SetaPDF_Core_DataStructure_Color_Rgb|array \SetaPDF_Core_Document_OutlinesItem::BOLD => boolean, \SetaPDF_Core_Document_OutlinesItem::ITALIC => boolean, );
Parameters
- $document : \SetaPDF_Core_Document
The document instance in which context the item will be used
- $titleOrConfig : string|array
The title or a configuration array
- $config : array
A configuration array
Exceptions
Methods
__construct()
The constructor.
Parameters
- $indirectReference : \SetaPDF_Core_Type_IndirectObjectInterface
Exceptions
_updateParentCount()
Increases or decreases the count value in the parent items.
Parameters
- $parentPdfDict : \SetaPDF_Core_Type_Dictionary|false
Exceptions
append()
?\SetaPDF_Core_Document $document = null,
?string $mode = null
Append another item to this item.
The $mode parameter can be used to specify the way the item will be appended: moved or copied.
Parameters
- $item : \SetaPDF_Core_Document_OutlinesItem
The item to append
- $document : ?\SetaPDF_Core_Document
The document instance in which context the item will be used
- $mode : ?string
The append mode. See OutlinesItem::APPEND_MODE_XXX constants for details.
Return Values
Returns the OutlinesItem object for method chaining.
Exceptions
Throws \LogicException
Throws \InvalidArgumentException
appendChild()
Append another item as a child of this item.
The $mode parameter can be used to specify the way the item will be appended: moved or copied.
Parameters
- $item : self
The item to append
- $document : ?\SetaPDF_Core_Document
The document instance in which context the item will be used
- $mode : string
The append mode. See OutlinesItem::APPEND_MODE_XXX constants for details.
Return Values
Returns the OutlinesItem object for method chaining.
Exceptions
Throws \InvalidArgumentException
appendChildCopy()
\SetaPDF_Core_Document $document
Appends a copy of another item or outline as a child to this item.
Parameters
- $originalItem : \SetaPDF_Core_Document_Catalog_Outlines|\SetaPDF_Core_Document_OutlinesItem
- $document : \SetaPDF_Core_Document
The document instance in which context the item will be used
Exceptions
appendCopy()
Appends a copy of another item to this item.
Parameters
- $originalItem : \SetaPDF_Core_Document_OutlinesItem
The original item
- $document : \SetaPDF_Core_Document
The document instance in which context the item will be used
Return Values
Returns the OutlinesItem object for method chaining.
Exceptions
close()
Close the item.
Alias for OutlinesItem::setOpen() with false as its argument.
Return Values
Returns the OutlinesItem object for method chaining.
Exceptions
contains()
Checks if an item is specified in any descendants of this item.
Parameters
- $item : \SetaPDF_Core_Document_OutlinesItem
The item to check for
- $checkAgainstThis : bool
True to check this instance against the item
Return Values
Whether the item is specified in any descendants of this item.
Exceptions
getAction()
Get the action of the item.
Return Values
The action instance or false if no action is defined.
Exceptions
getChildren()
getCount()
Get the number of visible outline items (value of the Count key).
Total number of visible outline items at all levels of the outline.
getDestination()
Get the destination of the item.
Parameters
- $document : ?\SetaPDF_Core_Document
The main document is needed to automatically resolve the destination
Return Values
A destination instance or false if none was defined.
Exceptions
getReferenceTo()
WARNING: This method is marked as deprecated!
Use getIndirectReference() instead
Get the reference to this item.
hasFirstItem()
Checks if this item has a 'First' value set.
The first item is the first item structured under this item. With this method you can check if the item has child items.
Return Values
True if a child item exists - false otherwise.
isOpen()
Checks whether the item is open or not or if the item does not holds any descendants.
Return Values
Returns true if the item is open, false if it is closed or null if the item does not holds any descendants.
move()
\SetaPDF_Core_Document $document,
string $mode = 'appendChild'
Move this item to another item or root outline.
The $mode parameter can be used to specify how the item will be moved.
Parameters
- $target : \SetaPDF_Core_Document_Catalog_Outlines|\SetaPDF_Core_Document_OutlinesItem
The target item
- $document : \SetaPDF_Core_Document
The document instance in which context the item will be used
- $mode : string
The move mode. See OutlinesItem::MOVE_MODE_XXX constants for details.
Return Values
Returns the OutlinesItem object for method chaining.
Exceptions
Throws \InvalidArgumentException
offsetExists()
Checks if an item exists at a specific position.
Parameters
- $offset : string|int
The index being checked
See
- \setasign\SetaPDF2\Core\Document\ArrayAccess::offsetExists()
offsetGet()
Get an item by a specific position.
Parameters
- $offset : string|int
The index with the value
Return Values
The value at the specified index.
Exceptions
Throws \InvalidArgumentException if no item is at the offset.
See
- \setasign\SetaPDF2\Core\Document\ArrayAccess::offsetGet()
offsetSet()
Set an item at a specific position.
Parameters
- $offset : null|string|int
The index being set
- $value : mixed
The new value for the index
Exceptions
Throws \setasign\SetaPDF2\Core\SecHandler\Exception
Throws \setasign\SetaPDF2\Core\Type\Exception
See
- \setasign\SetaPDF2\Core\Document\ArrayAccess::offsetSet()
- OutlinesItem::append()
- OutlinesItem::appendChild()
- OutlinesItem::remove()
offsetUnset()
Removes an item at a specific position.
Parameters
- $offset : string|int
The index being unset
Exceptions
Throws \setasign\SetaPDF2\Core\Type\Exception
See
- \setasign\SetaPDF2\Core\Document\ArrayAccess::offsetUnset()
open()
prepend()
?\SetaPDF_Core_Document $document = null,
string $mode = null
Prepend another item to this item.
The $mode parameter can be used to specify the way the item will be prepended: moved or copied.
Parameters
- $item : \SetaPDF_Core_Document_OutlinesItem
The item to prepend
- $document : ?\SetaPDF_Core_Document
The document instance in which context the item will be used
- $mode : string
The append mode. See OutlinesItem::APPEND_MODE_XXX constants for details.
Return Values
Returns the passed item or the last node in the item structure.
Exceptions
Throws \LogicException
Throws \InvalidArgumentException
prependCopy()
Prepends a copy of another item to this item.
Parameters
- $originalItem : \SetaPDF_Core_Document_OutlinesItem
The original item
- $document : \SetaPDF_Core_Document
The document instance in which context the item will be used
Return Values
Returns the OutlinesItem object for method chaining.
Exceptions
setAction()
Set the action of the item.
The action could be an instance of Action\Action, a dictionary or a reference to a dictionary representing the action.
Parameters
- $action : \SetaPDF_Core_Document_Action|\SetaPDF_Core_Type_IndirectObject|\SetaPDF_Core_Type_IndirectReference|\SetaPDF_Core_Type_Dictionary|null
The action to execute
Return Values
Returns the OutlinesItem object for method chaining.
Exceptions
Throws \InvalidArgumentException
setBold()
Sets whether the item should be displayed bold or not.
Parameters
- $bold : bool
True to display the item bold
Return Values
Returns the OutlinesItem object for method chaining.
setColor()
Set the color of the item.
Parameters
- $colorOrR : array|\SetaPDF_Core_DataStructure_Color_Rgb|float
An array of 3 integer values representing the rgb components (between 0 and 1), an instance of \setasign\SetaPDF2\Core\DataStructure\Color\Rgb or the red component value (between 0 and 1).
- $g : float
The green component value (between 0 and 1)
- $b : float
The blue component value (between 0 and 1)
Return Values
Returns the OutlinesItem object for method chaining.
setDestination()
Set the destination of the item.
Parameters
- $destination : \SetaPDF_Core_Type_IndirectObjectInterface|\SetaPDF_Core_Document_Destination|\SetaPDF_Core_Type_Array|\SetaPDF_Core_Type_StringValue|\SetaPDF_Core_Type_Name|string|null
The destination
Return Values
Returns the OutlinesItem object for method chaining.
Exceptions
Throws \InvalidArgumentException
setItalic()
Sets whether the item should be displayed italic or not.
Parameters
- $italic : bool
True to display the item italic
Return Values
Returns the OutlinesItem object for method chaining.
setOpen()
Open or close the item.
Parameters
- $open : bool
A boolean value specifying if the item is opened or not
Return Values
Returns the OutlinesItem object for method chaining.
Exceptions
setTitle()
string $encoding = 'UTF-8'
Set the item title.
Parameters
- $title : string
The item title
- $encoding : string
The input encoding
Return Values
Returns the OutlinesItem object for method chaining.