Class PDFPage

java.lang.Object
com.inductiveautomation.rm.pdf.reader.PDFPage

public class PDFPage extends Object
This class is used by RMPDFFile to read a PDF file (page) for parsing.
  • Constructor Details

    • PDFPage

      public PDFPage(PDFFile aPdfFile, int anIndex)
      Creates a new PDF page for the given PDF file and page index.
  • Method Details

    • getMediaBox

      public Rectangle2D getMediaBox()
      Returns the media box of this page.
    • getCropBox

      public Rectangle2D getCropBox()
      Returns the crop box of this page.
    • getResources

      public List getResources()
      Returns the resources stack for this page.
    • pushResources

      public void pushResources(Map r)
      Most pages will have only a single resource dictionary, which it may have inherited from the parent file. However, if the page has Forms or Patterns in it, there may be additional, temporary resource dictionaries.
    • popResources

      public void popResources()
    • getPageResources

      public Object getPageResources()
      Returns the main resource directory for the page, which may be a reference.
    • findResource

      public Object findResource(String resourceName, String name)
      Returns the named object from the page's resources. Used in more specific methods below for Fonts, ExtGStates, ColorSpaces, etc. This method is specific to entries in the resource dictionary that are themseleves dictionaries, but the only Resource which currently isn't a dictionaries is the ProcSet. If you need the ProcSet or something other than a dictionary, use getResources() and pull it out from there.
    • getExtendedGStateNamed

      public Map getExtendedGStateNamed(String name)
      Accessors for the resource dictionaries
    • getFontDictForAlias

      public Map getFontDictForAlias(String alias)
      Returns the pdf Font dictionary for a given name (like "/f1"). You can use the FontFactory to get interesting objects from the dictionary.
    • getColorspace

      public ColorSpace getColorspace(Object csobj)
      A colorspace can be specified in several ways. If a colorspace needs no arguments, in can just be the name. Otherwise, it is an entry in the page's resource dictionary. The format of the object in the resource dictionary is dependent upon the type of the colorspace. Once we figure out what kind of colorspace it is and the parameters, we can call the ColorFactory to make an awt ColorSpace object.

      Note that colorspaces in pdf are usually specified as either strings (for one of the built-ins) or arrays (eg. [/CalRGB << ... >>])

    • getXObject

      @Nullable public Object getXObject(String pdfName)
    • getPattern

      public PDFPattern getPattern(String pdfName)
      Creates a new pattern object for the resource name
    • getShading

      public ShadingPattern getShading(String pdfName)
      Creates a new shadingPattern for the resource name. Used by the shading operator
    • getPageContents

      public Object getPageContents()
      Returns the page contents for this page.
    • getPageContentsStream

      public PDFStream getPageContentsStream()
      Returns the page contents as a PDF stream.
    • getImage

      public BufferedImage getImage()
      Set everything to the default implementations and return an Image for this page.
    • paint

      public void paint(Graphics2D g, Rectangle2D r)
      Draw the page to g, scaled to fit the rectangle r.
    • parse

      public void parse()
      Main entry point for parsing the page marking operations
    • getPageDict

      @Nullable public Object getPageDict(@Nonnull Map pages, int pnum, int[] start)
      Returns the page dict for this page.