SetaPDF_Core_Document_Catalog_OptionalContent Class for handling optional content

File: /SetaPDF/Core/Document/Catalog/OptionalContent.php

Class hierarchy

Implements

Summary

Constants

STATE_OFF

State constant

STATE_ON

State constant

STATE_UNCHANGED

State constant


Properties

$_catalog

$_propertiesDictionary


Methods

__construct()

public SetaPDF_Core_Document_Catalog_OptionalContent::__construct ( SetaPDF_Core_Document_Catalog $catalog )

The constructor.

Parameters
$catalog : SetaPDF_Core_Document_Catalog
 

_getArrayFromDefaultViewing()

protected null|SetaPDF_Core_Type_Array SetaPDF_Core_Document_Catalog_OptionalContent::_getArrayFromDefaultViewing ( string $name [, boolean $create = false ] )

Get and/or create an array entry in the default viewing dictionary.

Parameters
$name : string
 
$create : boolean
 

addGroup()

public SetaPDF_Core_Document_OptionalContent_Group SetaPDF_Core_Document_Catalog_OptionalContent::addGroup ( SetaPDF_Core_Document_OptionalContent_Group|string $group )

This method adds a method to the OCGs array.

By adding a group with this method the group will not be added to the user interface.

Parameters
$group : SetaPDF_Core_Document_OptionalContent_Group|string
 

addUsageApplication()

public void SetaPDF_Core_Document_Catalog_OptionalContent::addUsageApplication ( SetaPDF_Core_Document_OptionalContent_Group $group )

Create and add usage application dictionaries for the given optional content group.

The usage definition in an optional content group will only apply to automatically adjustment if the group is referenced by a usage application dictionary.

$triangle = $optionalContent->appendGroup('Triangle');
// Define the usage
$triangle->usage()->setPrintState(SetaPDF_Core_Document_Catalog_OptionalContent::STATE_OFF);
// Now add it to an usage application dictionary
$optionalContent->addUsageApplication($triangle);
Parameters
$group : SetaPDF_Core_Document_OptionalContent_Group
 
See

appendGroup()

public SetaPDF_Core_Document_OptionalContent_Group SetaPDF_Core_Document_Catalog_OptionalContent::appendGroup ( string|SetaPDF_Core_Document_OptionalContent_Group $group [, SetaPDF_Core_Document_OptionalContent_Group $parent = null [, integer|null $afterIndex = null [, string|SetaPDF_Core_Document_OptionalContent_Group $nextToOrLabel = null [, string $label = '' ]]]] )

Append an optional content group to the outline structure.

Parameters
$group : string|SetaPDF_Core_Document_OptionalContent_Group
 
$parent : SetaPDF_Core_Document_OptionalContent_Group
 
$afterIndex : integer|null
 
$nextToOrLabel : string|SetaPDF_Core_Document_OptionalContent_Group
 
$label : string
 

cleanUp()

public void SetaPDF_Core_Document_Catalog_OptionalContent::cleanUp ( void )

Release resources / cycled references.

getAsArray()

public null|SetaPDF_Core_Type_Array SetaPDF_Core_Document_Catalog_OptionalContent::getAsArray ( [ boolean $create = false ] )

Get and/or create the AS array in the default viewing dictionary.

Parameters
$create : boolean
 
See
  • PDF 32000-1:2008 - 8.11.4.3 Optional Content Configuration Dictionaries

getBaseState()

public string SetaPDF_Core_Document_Catalog_OptionalContent::getBaseState ( void )

Get the base state from the default viewing dictionary.

See
  • PDF 32000-1:2008 - 8.11.4.3 Optional Content Configuration Dictionaries

getDefaultViewingDictionary()

public null|SetaPDF_Core_Type_Dictionary SetaPDF_Core_Document_Catalog_OptionalContent::getDefaultViewingDictionary ( [ boolean $create = false ] )

Get the default viewing dictionary.

Parameters
$create : boolean
 
See
  • PDF 32000-1:2008 - 8.11.4.2 Optional Content Properties Dictionary

getDocument()

public SetaPDF_Core_Document SetaPDF_Core_Document_Catalog_OptionalContent::getDocument ( void )

Get the document instance.

getGroup()

public false|SetaPDF_Core_Document_OptionalContent_Group SetaPDF_Core_Document_Catalog_OptionalContent::getGroup ( string $name [, string $encoding = 'UTF-8' ] )

Get a group by its name.

Parameters
$name : string

The group name

$encoding : string

The input encoding

getGroups()

public SetaPDF_Core_Document_OptionalContent_Group[] SetaPDF_Core_Document_Catalog_OptionalContent::getGroups ( void )

Get all available content groups.

getIterator()

public SetaPDF_Core_Document_OptionalContent_Iterator|EmptyIterator SetaPDF_Core_Document_Catalog_OptionalContent::getIterator ( void )

Implementation of IteratorAggregate.

A separate iterator is needed to receive SetaPDF_Core_Document_OptionalContent_Group objects while iterating.

See

getOffArray()

public null|SetaPDF_Core_Type_Array SetaPDF_Core_Document_Catalog_OptionalContent::getOffArray ( [ boolean $create = false ] )

Get and/or create the OFF array in the default viewing dictionary.

Parameters
$create : boolean
 
See
  • PDF 32000-1:2008 - 8.11.4.3 Optional Content Configuration Dictionaries

getOnArray()

public null|SetaPDF_Core_Type_Array SetaPDF_Core_Document_Catalog_OptionalContent::getOnArray ( [ boolean $create = false ] )

Get and/or create the ON array in the default viewing dictionary.

Parameters
$create : boolean
 
See
  • PDF 32000-1:2008 - 8.11.4.3 Optional Content Configuration Dictionaries

getOptionalContentPropertiesDictionary()

public null|SetaPDF_Core_Type_Dictionary SetaPDF_Core_Document_Catalog_OptionalContent::getOptionalContentPropertiesDictionary ( [ boolean $create = false ] )

Get and creates the optional content properties dictionary.

Parameters
$create : boolean
 

getOrderArray()

public null|SetaPDF_Core_Type_Array SetaPDF_Core_Document_Catalog_OptionalContent::getOrderArray ( [ boolean $create = false ] )

Get and/or create the Order array in the default viewing dictionary.

Parameters
$create : boolean
 
See
  • PDF 32000-1:2008 - 8.11.4.3 Optional Content Configuration Dictionaries

prependGroup()

public SetaPDF_Core_Document_OptionalContent_Group SetaPDF_Core_Document_Catalog_OptionalContent::prependGroup ( string|SetaPDF_Core_Document_OptionalContent_Group $group [, SetaPDF_Core_Document_OptionalContent_Group $parent = null [, integer|null $beforeIndex = 0 [, string|SetaPDF_Core_Document_OptionalContent_Group $nextToOrLabel = null [, string $label = '' ]]]] )

Prepends an optional content group to the outline structure.

If the $beforeIndex parameter is out of range the group will be appended.

Parameters
$group : string|SetaPDF_Core_Document_OptionalContent_Group
 
$parent : SetaPDF_Core_Document_OptionalContent_Group
 
$beforeIndex : integer|null
 
$nextToOrLabel : string|SetaPDF_Core_Document_OptionalContent_Group
 
$label : string
 

setBaseState()

public void SetaPDF_Core_Document_Catalog_OptionalContent::setBaseState ( string $baseState )

Set the base state in the default viewing dictionary.

Parameters
$baseState : string
 
See
  • PDF 32000-1:2008 - 8.11.4.3 Optional Content Configuration Dictionaries

setOff()

public void SetaPDF_Core_Document_Catalog_OptionalContent::setOff ( SetaPDF_Core_Document_OptionalContent_Group $group )

Set the default state of the optional content group to off.

Parameters
$group : SetaPDF_Core_Document_OptionalContent_Group
 

setOn()

public void SetaPDF_Core_Document_Catalog_OptionalContent::setOn ( SetaPDF_Core_Document_OptionalContent_Group $group )

Set the default state of the optional content group to on.

Parameters
$group : SetaPDF_Core_Document_OptionalContent_Group