Class 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 Details

  • Constructor Details

    • PDFResources

      public PDFResources(PDFDocument doc)
      create a /Resources object.
  • Method Details

    • 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(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 to
      fontInfo - 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(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(String name, PDFReference property)
      Add a named property.
      Parameters:
      name - name of property
      property - reference to property value
    • getProperty

      public PDFReference getProperty(String name)
      Get a named property.
      Parameters:
      name - name of property
    • output

      public int output(OutputStream stream) throws IOException
      Description copied from class: PDFDictionary
      Write the PDF represention of this object
      Overrides:
      output in class PDFDictionary
      Parameters:
      stream - the stream to write the PDF to
      Returns:
      the number of bytes written
      Throws:
      IOException - if there is an error writing to the stream
    • getChildren

      public void getChildren(Set<PDFObject> children)
      Overrides:
      getChildren in class PDFDictionary