org.pdfbox.pdmodel
Class PDResources
java.lang.Object
org.pdfbox.pdmodel.PDResources
- COSObjectable
public class PDResources
extends java.lang.Object
This represents a set of resources available at the page/pages/stream level.
PDResources
public PDResources()
Default constructor.
PDResources
public PDResources(COSDictionary resourceDictionary)
Prepopulated resources.
resourceDictionary
- The cos dictionary for this resource.
getCOSDictionary
public COSDictionary getCOSDictionary()
This will get the underlying dictionary.
- The dictionary for these resources.
getCOSObject
public COSBase getCOSObject()
Convert this standard java object to a COS object.
- getCOSObject in interface COSObjectable
- The cos object that matches this Java object.
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.
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.
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.
fontCache
- A map of existing PDFont objects to reuse.
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.
- The map of extended graphic state objects.
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.
getXObjects
public Map getXObjects()
throws IOException
This will get the map of PDXObjects that are in the resource dictionary.
setColorSpaces
public void setColorSpaces(Map colorspaces)
This will set the map of colorspaces.
colorspaces
- The new map of colorspaces.
setFonts
public void setFonts(Map fonts)
This will set the map of fonts.
fonts
- The new map of fonts.
setGraphicsStates
public void setGraphicsStates(Map states)
This will set the map of graphics states.
states
- The new map of states.