Package com.ribs.pdf
Class PDFPage
- java.lang.Object
-
- com.ribs.pdf.PDFPage
-
public class PDFPage extends java.lang.Object
This class is used by RMPDFFile to read a PDF file (page) for parsing.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
findResource(java.lang.String resourceName, java.lang.String name)
Returns the named object from the page's resources.java.awt.color.ColorSpace
getColorspace(java.lang.Object csobj)
A colorspace can be specified in several ways.java.awt.geom.Rectangle2D
getCropBox()
Returns the crop box of this page.java.util.Map
getExtendedGStateNamed(java.lang.String name)
Accessors for the resource dictionariesjava.util.Map
getFontDictForAlias(java.lang.String alias)
Returns the pdf Font dictionary for a given name (like "/f1").java.awt.Image
getImage()
Set everything to the default implementations and return an Image for this page.java.awt.geom.Rectangle2D
getMediaBox()
Returns the media box of this page.java.lang.Object
getPageContents()
Returns the page contents for this page.PDFStream
getPageContentsStream()
Returns the page contents as a PDF stream.java.lang.Object
getPageDict(java.util.Hashtable pages, int pnum, int[] start)
Returns the page dict for this page.java.lang.Object
getPageResources()
Returns the main resource directory for the page, which may be a reference.PDFPattern
getPattern(java.lang.String pdfName)
Creates a new pattern object for the resource namejava.util.List
getResources()
Returns the resources stack for this page.PDFShadingPattern
getShading(java.lang.String pdfName)
Creates a new shadingPattern for the resource name.java.lang.Object
getXObject(java.lang.String pdfName)
void
parse()
Main entry point for parsing the page marking operationsvoid
popResources()
void
pushResources(java.util.Map r)
Most pages will have only a single resource dictionary, which it may have inherited from the parent file.
-
-
-
Constructor Detail
-
PDFPage
public PDFPage(PDFFile aPdfFile, int anIndex)
Creates a new PDF page for the given PDF file and page index.
-
-
Method Detail
-
getMediaBox
public java.awt.geom.Rectangle2D getMediaBox()
Returns the media box of this page.
-
getCropBox
public java.awt.geom.Rectangle2D getCropBox()
Returns the crop box of this page.
-
getResources
public java.util.List getResources()
Returns the resources stack for this page.
-
pushResources
public void pushResources(java.util.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 java.lang.Object getPageResources()
Returns the main resource directory for the page, which may be a reference.
-
findResource
public java.lang.Object findResource(java.lang.String resourceName, java.lang.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 java.util.Map getExtendedGStateNamed(java.lang.String name)
Accessors for the resource dictionaries
-
getFontDictForAlias
public java.util.Map getFontDictForAlias(java.lang.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 java.awt.color.ColorSpace getColorspace(java.lang.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
public java.lang.Object getXObject(java.lang.String pdfName)
-
getPattern
public PDFPattern getPattern(java.lang.String pdfName)
Creates a new pattern object for the resource name
-
getShading
public PDFShadingPattern getShading(java.lang.String pdfName)
Creates a new shadingPattern for the resource name. Used by the shading operator
-
getPageContents
public java.lang.Object getPageContents()
Returns the page contents for this page.
-
getPageContentsStream
public PDFStream getPageContentsStream()
Returns the page contents as a PDF stream.
-
getImage
public java.awt.Image getImage()
Set everything to the default implementations and return an Image for this page.
-
parse
public void parse()
Main entry point for parsing the page marking operations
-
getPageDict
public java.lang.Object getPageDict(java.util.Hashtable pages, int pnum, int[] start)
Returns the page dict for this page.
-
-