public final class PDResources extends Object implements COSObjectable
Constructor and Description |
---|
PDResources()
Constructor for embedding.
|
PDResources(COSDictionary resourceDictionary)
Constructor for reading.
|
PDResources(COSDictionary resourceDictionary,
ResourceCache resourceCache)
Constructor for reading.
|
Modifier and Type | Method and Description |
---|---|
COSName |
add(PDAbstractPattern pattern)
Adds the given pattern to the resources of the current page and returns the name for the
new resources.
|
COSName |
add(PDColorSpace colorSpace)
Adds the given color space to the resources of the current page and returns the name for the
new resources.
|
COSName |
add(PDExtendedGraphicsState extGState)
Adds the given extended graphics state to the resources of the current page and returns the
name for the new resources.
|
COSName |
add(PDFont font)
Adds the given font to the resources of the current page and returns the name for the
new resources.
|
COSName |
add(PDFormXObject form)
Adds the given form to the resources of the current page and returns the name for the
new resources.
|
COSName |
add(PDImageXObject image)
Adds the given image to the resources of the current page and returns the name for the
new resources.
|
COSName |
add(PDPropertyList properties)
Adds the given property list to the resources of the current page and returns the name for
the new resources.
|
COSName |
add(PDShading shading)
Adds the given shading to the resources of the current page and returns the name for the
new resources.
|
COSName |
add(PDXObject xobject,
String prefix)
Adds the given XObject to the resources of the current page and returns the name for the
new resources.
|
PDColorSpace |
getColorSpace(COSName name)
Returns the color space resource with the given name, or null if none exists.
|
PDColorSpace |
getColorSpace(COSName name,
boolean wasDefault)
Returns the color space resource with the given name, or null if none exists.
|
Iterable<COSName> |
getColorSpaceNames()
Returns the names of the color space resources, if any.
|
COSDictionary |
getCOSObject()
Returns the underlying dictionary.
|
PDExtendedGraphicsState |
getExtGState(COSName name)
Returns the extended graphics state resource with the given name, or null if none exists.
|
Iterable<COSName> |
getExtGStateNames()
Returns the names of the extended graphics state resources, if any.
|
PDFont |
getFont(COSName name)
Returns the font resource with the given name, or null if none exists.
|
Iterable<COSName> |
getFontNames()
Returns the names of the font resources, if any.
|
PDAbstractPattern |
getPattern(COSName name)
Returns the pattern resource with the given name, or null if none exists.
|
Iterable<COSName> |
getPatternNames()
Returns the names of the pattern resources, if any.
|
PDPropertyList |
getProperties(COSName name)
Returns the property list resource with the given name, or null if none exists.
|
Iterable<COSName> |
getPropertiesNames()
Returns the names of the property list resources, if any.
|
ResourceCache |
getResourceCache()
Returns the resource cache associated with the Resources, or null if there is none.
|
PDShading |
getShading(COSName name)
Returns the shading resource with the given name, or null if none exists.
|
Iterable<COSName> |
getShadingNames()
Returns the names of the shading resources, if any.
|
PDXObject |
getXObject(COSName name)
Returns the XObject resource with the given name, or null if none exists.
|
Iterable<COSName> |
getXObjectNames()
Returns the names of the XObject resources, if any.
|
boolean |
hasColorSpace(COSName name)
Returns true if the given color space name exists in these resources.
|
boolean |
isImageXObject(COSName name)
Tells whether the XObject resource with the given name is an image.
|
void |
put(COSName name,
PDAbstractPattern pattern)
Sets the pattern resource with the given name.
|
void |
put(COSName name,
PDColorSpace colorSpace)
Sets the color space resource with the given name.
|
void |
put(COSName name,
PDExtendedGraphicsState extGState)
Sets the extended graphics state resource with the given name.
|
void |
put(COSName name,
PDFont font)
Sets the font resource with the given name.
|
void |
put(COSName name,
PDPropertyList properties)
Sets the property list resource with the given name.
|
void |
put(COSName name,
PDShading shading)
Sets the shading resource with the given name.
|
void |
put(COSName name,
PDXObject xobject)
Sets the XObject resource with the given name.
|
public PDResources()
public PDResources(COSDictionary resourceDictionary)
resourceDictionary
- The cos dictionary for this resource.public PDResources(COSDictionary resourceDictionary, ResourceCache resourceCache)
resourceDictionary
- The cos dictionary for this resource.resourceCache
- The document's resource cache, may be null.public COSDictionary getCOSObject()
getCOSObject
in interface COSObjectable
public PDFont getFont(COSName name) throws IOException
name
- Name of the font resource.IOException
- if something went wrong.public PDColorSpace getColorSpace(COSName name) throws IOException
name
- Name of the color space resource.IOException
- if something went wrong.public PDColorSpace getColorSpace(COSName name, boolean wasDefault) throws IOException
getColorSpace(COSName)
.name
- Name of the color space resource.wasDefault
- if current color space was used by a default color space. This parameter is
toIOException
- if something went wrong.public boolean hasColorSpace(COSName name)
name
- Name of the color space resource.public PDExtendedGraphicsState getExtGState(COSName name)
name
- Name of the graphics state resource.public PDShading getShading(COSName name) throws IOException
name
- Name of the shading resource.IOException
- if something went wrong.public PDAbstractPattern getPattern(COSName name) throws IOException
name
- Name of the pattern resource.IOException
- if something went wrong.public PDPropertyList getProperties(COSName name)
name
- Name of the property list resource.public boolean isImageXObject(COSName name)
name
- Name of the XObject resource.public PDXObject getXObject(COSName name) throws IOException
name
- Name of the XObject resource.IOException
- if something went wrong.public Iterable<COSName> getColorSpaceNames()
public Iterable<COSName> getXObjectNames()
public Iterable<COSName> getFontNames()
public Iterable<COSName> getPropertiesNames()
public Iterable<COSName> getShadingNames()
public Iterable<COSName> getPatternNames()
public Iterable<COSName> getExtGStateNames()
public COSName add(PDFont font)
font
- the font to addpublic COSName add(PDColorSpace colorSpace)
colorSpace
- the color space to addpublic COSName add(PDExtendedGraphicsState extGState)
extGState
- the extended graphics state to addpublic COSName add(PDShading shading)
shading
- the shading to addpublic COSName add(PDAbstractPattern pattern)
pattern
- the pattern to addpublic COSName add(PDPropertyList properties)
properties
- the property list to addpublic COSName add(PDImageXObject image)
image
- the image to addpublic COSName add(PDFormXObject form)
form
- the form to addpublic COSName add(PDXObject xobject, String prefix)
xobject
- the XObject to addprefix
- the prefix to be used when creating the resource namepublic void put(COSName name, PDFont font)
name
- the name of the resourcefont
- the font to be addedpublic void put(COSName name, PDColorSpace colorSpace)
name
- the name of the resourcecolorSpace
- the color space to be addedpublic void put(COSName name, PDExtendedGraphicsState extGState)
name
- the name of the resourceextGState
- the extended graphics state to be addedpublic void put(COSName name, PDShading shading)
name
- the name of the resourceshading
- the shading to be addedpublic void put(COSName name, PDAbstractPattern pattern)
name
- the name of the resourcepattern
- the pattern to be addedpublic void put(COSName name, PDPropertyList properties)
name
- the name of the resourceproperties
- the property list to be addedpublic void put(COSName name, PDXObject xobject)
name
- the name of the resourcexobject
- the XObject to be addedpublic ResourceCache getResourceCache()
Copyright © 2002–2018 The Apache Software Foundation. All rights reserved.