org.pdfbox.pdmodel

Class PDPageNode

Implemented Interfaces:
COSObjectable

public class PDPageNode
extends java.lang.Object
implements COSObjectable

This represents a page node in a pdf document.
Version:
$Revision: 1.8 $
Author:
Ben Litchfield

Constructor Summary

PDPageNode()
Creates a new instance of PDPage.
PDPageNode(COSDictionary pages)
Creates a new instance of PDPage.

Method Summary

PDRectangle
findCropBox()
This will find the CropBox for this page by looking up the hierarchy until it finds them.
PDRectangle
findMediaBox()
This will find the MediaBox for this page by looking up the hierarchy until it finds them.
PDResources
findResources()
This will find the resources for this page by looking up the hierarchy until it finds them.
int
findRotation()
This will find the rotation for this page by looking up the hierarchy until it finds them.
void
getAllKids(List result)
This will return all kids of this node as PDPage.
COSBase
getCOSObject()
long
getCount()
This will get the count of descendent page objects.
PDRectangle
getCropBox()
This will get the CropBox at this page and not look up the hierarchy.
COSDictionary
getDictionary()
This will get the underlying dictionary that this class acts on.
List
getKids()
This will return all kids of this node, either PDPageNode or PDPage.
PDRectangle
getMediaBox()
This will get the MediaBox at this page and not look up the hierarchy.
PDPageNode
getParent()
This is the parent page node.
PDResources
getResources()
This will get the resources at this page node and not look up the hierarchy.
Integer
getRotation()
A value representing the rotation.
void
setCropBox(PDRectangle cropBox)
This will set the CropBox for this page.
void
setMediaBox(PDRectangle mediaBox)
This will set the mediaBox for this page.
void
setParent(PDPageNode parent)
This will set the parent of this page.
void
setResources(PDResources resources)
This will set the resources for this page.
void
setRotation(int rotation)
This will set the rotation for this page.
long
updateCount()
This will update the count attribute of the page node.

Constructor Details

PDPageNode

public PDPageNode()
Creates a new instance of PDPage.

PDPageNode

public PDPageNode(COSDictionary pages)
Creates a new instance of PDPage.
Parameters:
pages - The dictionary pages.

Method Details

findCropBox

public PDRectangle findCropBox()
This will find the CropBox for this page by looking up the hierarchy until it finds them.
Returns:
The CropBox at this level in the hierarchy.

findMediaBox

public PDRectangle findMediaBox()
This will find the MediaBox for this page by looking up the hierarchy until it finds them.
Returns:
The MediaBox at this level in the hierarchy.

findResources

public PDResources findResources()
This will find the resources for this page by looking up the hierarchy until it finds them.
Returns:
The resources at this level in the hierarchy.

findRotation

public int findRotation()
This will find the rotation for this page by looking up the hierarchy until it finds them.
Returns:
The rotation at this level in the hierarchy.

getAllKids

public void getAllKids(List result)
This will return all kids of this node as PDPage.
Parameters:
result - All direct and indirect descendents of this node are added to this list.

getCOSObject

public COSBase getCOSObject()
Specified by:
getCOSObject in interface COSObjectable

getCount

public long getCount()
This will get the count of descendent page objects.
Returns:
The total number of descendent page objects.

getCropBox

public PDRectangle getCropBox()
This will get the CropBox at this page and not look up the hierarchy. This attribute is inheritable, and findCropBox() should probably used. This will return null if no CropBox is available at this level.
Returns:
The CropBox at this level in the hierarchy.

getDictionary

public COSDictionary getDictionary()
This will get the underlying dictionary that this class acts on.
Returns:
The underlying dictionary for this class.

getKids

public List getKids()
This will return all kids of this node, either PDPageNode or PDPage.
Returns:
All direct descendents of this node.

getMediaBox

public PDRectangle getMediaBox()
This will get the MediaBox at this page and not look up the hierarchy. This attribute is inheritable, and findMediaBox() should probably used. This will return null if no MediaBox are available at this level.
Returns:
The MediaBox at this level in the hierarchy.

getParent

public PDPageNode getParent()
This is the parent page node.
Returns:
The parent to this page.

getResources

public PDResources getResources()
This will get the resources at this page node and not look up the hierarchy. This attribute is inheritable, and findResources() should probably used. This will return null if no resources are available at this level.
Returns:
The resources at this level in the hierarchy.

getRotation

public Integer getRotation()
A value representing the rotation. This will be null if not set at this level The number of degrees by which the page should be rotated clockwise when displayed or printed. The value must be a multiple of 90. This will get the rotation at this page and not look up the hierarchy. This attribute is inheritable, and findRotation() should probably used. This will return null if no rotation is available at this level.
Returns:
The rotation at this level in the hierarchy.

setCropBox

public void setCropBox(PDRectangle cropBox)
This will set the CropBox for this page.
Parameters:
cropBox - The new CropBox for this page.

setMediaBox

public void setMediaBox(PDRectangle mediaBox)
This will set the mediaBox for this page.
Parameters:
mediaBox - The new mediaBox for this page.

setParent

public void setParent(PDPageNode parent)
This will set the parent of this page.
Parameters:
parent - The parent to this page node.

setResources

public void setResources(PDResources resources)
This will set the resources for this page.
Parameters:
resources - The new resources for this page.

setRotation

public void setRotation(int rotation)
This will set the rotation for this page.
Parameters:
rotation - The new rotation for this page.

updateCount

public long updateCount()
This will update the count attribute of the page node. This only needs to be called if you add or remove pages. The PDDocument will call this for you when you use the PDDocumnet persistence methods. So, basically most clients will never need to call this.
Returns:
The update count for this node.