org.apache.pdfbox.pdmodel.graphics.optionalcontent
Class PDOptionalContentProperties

java.lang.Object
  extended by org.apache.pdfbox.pdmodel.graphics.optionalcontent.PDOptionalContentProperties
All Implemented Interfaces:
COSObjectable

public class PDOptionalContentProperties
extends Object
implements COSObjectable

This class represents the optional content properties dictionary.

Since:
PDF 1.5
Version:
$Revision$

Nested Class Summary
static class PDOptionalContentProperties.BaseState
          Enumeration for the BaseState dictionary entry on the "D" dictionary.
 
Constructor Summary
PDOptionalContentProperties()
          Creates a new optional content properties dictionary.
PDOptionalContentProperties(COSDictionary props)
          Creates a new instance based on a given COSDictionary.
 
Method Summary
 void addGroup(PDOptionalContentGroup ocg)
          Adds an optional content group (OCG).
 PDOptionalContentProperties.BaseState getBaseState()
          Returns the base state for optional content groups.
 COSBase getCOSObject()
          Convert this standard java object to a COS object.
 PDOptionalContentGroup getGroup(String name)
          Returns the optional content group of the given name.
 String[] getGroupNames()
          Lists all optional content group names.
 Collection<PDOptionalContentGroup> getOptionalContentGroups()
          Returns the collection of all optional content groups.
 boolean hasGroup(String groupName)
          Indicates whether a particular optional content group is found in the PDF file.
 boolean isGroupEnabled(String groupName)
          Indicates whether an optional content group is enabled.
 void setBaseState(PDOptionalContentProperties.BaseState state)
          Sets the base state for optional content groups.
 boolean setGroupEnabled(String groupName, boolean enable)
          Enables or disables an optional content group.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PDOptionalContentProperties

public PDOptionalContentProperties()
Creates a new optional content properties dictionary.


PDOptionalContentProperties

public PDOptionalContentProperties(COSDictionary props)
Creates a new instance based on a given COSDictionary.

Parameters:
props - the dictionary
Method Detail

getCOSObject

public COSBase getCOSObject()
Convert this standard java object to a COS object.

Specified by:
getCOSObject in interface COSObjectable
Returns:
The cos object that matches this Java object.

getGroup

public PDOptionalContentGroup getGroup(String name)
Returns the optional content group of the given name.

Parameters:
name - the group name
Returns:
the optional content group or null, if there is no such group

addGroup

public void addGroup(PDOptionalContentGroup ocg)
Adds an optional content group (OCG).

Parameters:
ocg - the optional content group

getOptionalContentGroups

public Collection<PDOptionalContentGroup> getOptionalContentGroups()
Returns the collection of all optional content groups.

Returns:
the optional content groups

getBaseState

public PDOptionalContentProperties.BaseState getBaseState()
Returns the base state for optional content groups.

Returns:
the base state

setBaseState

public void setBaseState(PDOptionalContentProperties.BaseState state)
Sets the base state for optional content groups.

Parameters:
state - the base state

getGroupNames

public String[] getGroupNames()
Lists all optional content group names.

Returns:
an array of all names

hasGroup

public boolean hasGroup(String groupName)
Indicates whether a particular optional content group is found in the PDF file.

Parameters:
groupName - the group name
Returns:
true if the group exists, false otherwise

isGroupEnabled

public boolean isGroupEnabled(String groupName)
Indicates whether an optional content group is enabled.

Parameters:
groupName - the group name
Returns:
true if the group is enabled

setGroupEnabled

public boolean setGroupEnabled(String groupName,
                               boolean enable)
Enables or disables an optional content group.

Parameters:
groupName - the group name
enable - true to enable, false to disable
Returns:
true if the group already had an on or off setting, false otherwise


Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved.