org.apache.pdfbox.pdmodel
Class PDResources

java.lang.Object
  extended by org.apache.pdfbox.pdmodel.PDResources
All Implemented Interfaces:
COSObjectable

public class PDResources
extends Object
implements COSObjectable

This represents a set of resources available at the page/pages/stream level.

Version:
$Revision: 1.16 $
Author:
Ben Litchfield

Constructor Summary
PDResources()
          Default constructor.
PDResources(COSDictionary resourceDictionary)
          Prepopulated resources.
 
Method Summary
 Map getColorSpaces()
          This will get the map of colorspaces.
 COSDictionary getCOSDictionary()
          This will get the underlying dictionary.
 COSBase getCOSObject()
          Convert this standard java object to a COS object.
 Map getFonts()
          This will get the map of fonts.
 Map getFonts(Map fontCache)
          This will get the map of fonts.
 Map getGraphicsStates()
          This will get the map of graphic states.
 Map getImages()
          This will get the map of images.
 Map getXObjects()
          This will get the map of PDXObjects that are in the resource dictionary.
 void setColorSpaces(Map colorspaces)
          This will set the map of colorspaces.
 void setFonts(Map fonts)
          This will set the map of fonts.
 void setGraphicsStates(Map states)
          This will set the map of graphics states.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PDResources

public PDResources()
Default constructor.


PDResources

public PDResources(COSDictionary resourceDictionary)
Prepopulated resources.

Parameters:
resourceDictionary - The cos dictionary for this resource.
Method Detail

getCOSDictionary

public COSDictionary getCOSDictionary()
This will get the underlying dictionary.

Returns:
The dictionary for these resources.

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.

getFonts

public Map getFonts(Map fontCache)
             throws IOException
This will get the map of fonts. This will never return null. The keys are string and the values are PDFont objects.

Parameters:
fontCache - A map of existing PDFont objects to reuse.
Returns:
The map of fonts.
Throws:
IOException - If there is an error getting the fonts.

getFonts

public Map getFonts()
             throws IOException
This will get the map of fonts. This will never return null. The keys are string and the values are PDFont objects.

Returns:
The map of fonts.
Throws:
IOException - If there is an error getting the fonts.

getXObjects

public Map getXObjects()
                throws IOException
This will get the map of PDXObjects that are in the resource dictionary.

Returns:
The map of xobjects.
Throws:
IOException - If there is an error creating the xobjects.

getImages

public Map getImages()
              throws IOException
This will get the map of images. An empty map will be returned if there are no underlying images. So far the keys are COSName of the image and the value is the corresponding PDXObjectImage.

Returns:
The map of images.
Throws:
IOException - If there is an error writing the picture.

setFonts

public void setFonts(Map fonts)
This will set the map of fonts.

Parameters:
fonts - The new map of fonts.

getColorSpaces

public Map getColorSpaces()
                   throws IOException
This will get the map of colorspaces. This will return null if the underlying resources dictionary does not have a colorspace dictionary. The keys are string and the values are PDColorSpace objects.

Returns:
The map of colorspaces.
Throws:
IOException - If there is an error getting the colorspaces.

setColorSpaces

public void setColorSpaces(Map colorspaces)
This will set the map of colorspaces.

Parameters:
colorspaces - The new map of colorspaces.

getGraphicsStates

public Map getGraphicsStates()
This will get the map of graphic states. This will return null if the underlying resources dictionary does not have a graphics dictionary. The keys are the graphic state name as a String and the values are PDExtendedGraphicsState objects.

Returns:
The map of extended graphic state objects.

setGraphicsStates

public void setGraphicsStates(Map states)
This will set the map of graphics states.

Parameters:
states - The new map of states.


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