Package org.apache.fop.pdf
Class PDFResources
- java.lang.Object
-
- org.apache.fop.pdf.PDFObject
-
- org.apache.fop.pdf.PDFDictionary
-
- org.apache.fop.pdf.PDFResources
-
- All Implemented Interfaces:
PDFWritable
public class PDFResources extends PDFDictionary
Class representing a /Resources object. /Resources object contain a list of references to the fonts, patterns, shadings, etc., for the document.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<org.apache.fop.pdf.PDFResources.LazyName,PDFColorSpace>colorSpacesMap of color spaces (key: color space name)protected java.util.Set<PDFResourceContext>contextsprotected java.util.Map<java.lang.String,PDFDictionary>fonts/Font objects keyed by their internal nameprotected java.util.Map<java.lang.String,PDFICCBasedColorSpace>iccColorSpacesMap of ICC color spaces (key: ICC profile description)protected java.util.Map<java.lang.String,PDFReference>propertiesNamed propertiesprotected java.util.Set<PDFXObject>xObjectsSet of XObjects-
Fields inherited from class org.apache.fop.pdf.PDFDictionary
entries, order
-
-
Constructor Summary
Constructors Constructor Description PDFResources(PDFDocument doc)create a /Resources object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddColorSpace(PDFColorSpace colorSpace)Add a ColorSpace dictionary to the resources.voidaddContext(PDFResourceContext c)voidaddFont(java.lang.String name, PDFDictionary font)voidaddFont(PDFFont font)add font object to resources list.voidaddFonts(PDFDocument doc, FontInfo fontInfo)Add the fonts in the font info to this PDF document's Font Resources.voidaddProperty(java.lang.String name, PDFReference property)Add a named property.voidaddXObject(PDFXObject xObject)Add an XObject to the resources.voidcreateFontsAsObj()voidgetChildren(java.util.Set<PDFObject> children)PDFColorSpacegetColorSpace(PDFName name)Returns a color space by name.PDFICCBasedColorSpacegetICCColorSpaceByProfileName(java.lang.String desc)Returns a ICCBased color space by profile name.PDFResourcesgetParentResources()PDFReferencegetProperty(java.lang.String name)Get a named property.intoutput(java.io.OutputStream stream)Write the PDF represention of this objectvoidsetParentResources(PDFResources p)-
Methods inherited from class org.apache.fop.pdf.PDFDictionary
containsKey, get, getChildren, keySet, put, put, remove, writeDictionary
-
Methods inherited from class org.apache.fop.pdf.PDFObject
contentEquals, encode, encodeBinaryToHexString, encodeString, encodeText, formatObject, getDocument, getDocumentSafely, getGeneration, getObjectID, getObjectNumber, getParent, hasObjectNumber, makeReference, outputInline, referencePDF, setDocument, setObjectNumber, setObjectNumber, setObjectNumber, setParent, toPDF, toPDFString
-
-
-
-
Field Detail
-
fonts
protected java.util.Map<java.lang.String,PDFDictionary> fonts
/Font objects keyed by their internal name
-
xObjects
protected java.util.Set<PDFXObject> xObjects
Set of XObjects
-
colorSpaces
protected java.util.Map<org.apache.fop.pdf.PDFResources.LazyName,PDFColorSpace> colorSpaces
Map of color spaces (key: color space name)
-
iccColorSpaces
protected java.util.Map<java.lang.String,PDFICCBasedColorSpace> iccColorSpaces
Map of ICC color spaces (key: ICC profile description)
-
properties
protected java.util.Map<java.lang.String,PDFReference> properties
Named properties
-
contexts
protected java.util.Set<PDFResourceContext> contexts
-
-
Constructor Detail
-
PDFResources
public PDFResources(PDFDocument doc)
create a /Resources object.
-
-
Method Detail
-
addContext
public void addContext(PDFResourceContext c)
-
setParentResources
public void setParentResources(PDFResources p)
-
getParentResources
public PDFResources getParentResources()
-
addFont
public void addFont(PDFFont font)
add font object to resources list.- Parameters:
font- the PDFFont to add
-
addFont
public void addFont(java.lang.String name, PDFDictionary font)
-
createFontsAsObj
public void createFontsAsObj()
-
addFonts
public void addFonts(PDFDocument doc, FontInfo fontInfo)
Add the fonts in the font info to this PDF document's Font Resources.- Parameters:
doc- PDF document to add fonts tofontInfo- font info object to get font information from
-
addXObject
public void addXObject(PDFXObject xObject)
Add an XObject to the resources.- Parameters:
xObject- the XObject to add
-
addColorSpace
public void addColorSpace(PDFColorSpace colorSpace)
Add a ColorSpace dictionary to the resources.- Parameters:
colorSpace- the color space
-
getICCColorSpaceByProfileName
public PDFICCBasedColorSpace getICCColorSpaceByProfileName(java.lang.String desc)
Returns a ICCBased color space by profile name.- Parameters:
desc- the name of the color space- Returns:
- the requested color space or null if it wasn't found
-
getColorSpace
public PDFColorSpace getColorSpace(PDFName name)
Returns a color space by name.- Parameters:
name- the name of the color space- Returns:
- the requested color space or null if it wasn't found
-
addProperty
public void addProperty(java.lang.String name, PDFReference property)Add a named property.- Parameters:
name- name of propertyproperty- reference to property value
-
getProperty
public PDFReference getProperty(java.lang.String name)
Get a named property.- Parameters:
name- name of property
-
output
public int output(java.io.OutputStream stream) throws java.io.IOExceptionDescription copied from class:PDFDictionaryWrite the PDF represention of this object- Overrides:
outputin classPDFDictionary- Parameters:
stream- the stream to write the PDF to- Returns:
- the number of bytes written
- Throws:
java.io.IOException- if there is an error writing to the stream
-
getChildren
public void getChildren(java.util.Set<PDFObject> children)
- Overrides:
getChildrenin classPDFDictionary
-
-