intarsys PDF library API

de.intarsys.pdf.pd
Class PDPage

java.lang.Object
  extended by de.intarsys.pdf.cos.COSBasedObject
      extended by de.intarsys.pdf.pd.PDObject
          extended by de.intarsys.pdf.pd.PDPageNode
              extended by de.intarsys.pdf.pd.PDPage
All Implemented Interfaces:
IContentStreamProvider, ICOSObjectListener, IAdditionalActionSupport, IResourcesProvider, IAttributeSupport

public class PDPage
extends PDPageNode
implements IAdditionalActionSupport, IContentStreamProvider

A single concrete page in a PDF document.


Nested Class Summary
static class PDPage.MetaClass
          The meta class implementation
 
Field Summary
static String COPY_SUFFIX
           
static COSName DK_Annots
           
static COSName DK_Contents
           
static COSName DK_CropBox
           
static COSName DK_MediaBox
           
static COSName DK_Metadata
           
static COSName DK_PieceInfo
           
static COSName DK_Resources
           
static PDPage.MetaClass META
          The meta class instance
static Set PAGE_ACTION_TRIGGERS
          supported additional action triggers
 
Fields inherited from class de.intarsys.pdf.pd.PDPageNode
CN_Type_Page, DK_Pages, DK_Parent, DK_Rotate
 
Fields inherited from class de.intarsys.pdf.pd.PDObject
DK_Subtype, DK_Type
 
Fields inherited from interface de.intarsys.pdf.pd.IAdditionalActionSupport
DK_AA
 
Method Summary
 void addAnnotation(PDAnnotation annot)
          Add a PDAnnotation to the collection of annotations on the receiver page.
 void addContentStream(CSContent contentStream)
          Add a CSContent stream to this.
 void cosAddContents(COSStream content)
          Append COSStream to the pages content
 COSObject cosGetContents()
          The /Contents entry
 COSDictionary cosGetPieceInfo()
          The piece info dictionary of the document.
 void cosPrependContents(COSStream content)
          Prepend contents to the pages content.
 COSObject cosSetContents(COSObject content)
          Set the /Contents for the page
 COSDictionary cosSetPieceInfo(COSDictionary dict)
          Set the piece info dictionary of the document.
 void dispose()
           
 PDAdditionalActions getAdditionalActions()
           
 List getAnnotations()
          Get a list of all PDAnnotation objects that are referenced in this page.
 PDApplicationData getApplicationData(String name)
          The PDApplicationData associated with name on the page.
 CSContent getContentStream()
          The CSContent defining the visual content of the page.
 int getCount()
          The total number of pages represented by this node.
 PDAnnotation getFirstAnnotation()
          The first PDAnnotation linked on this page.
 PDPageNode getFirstNode()
          Get the first node within the receiver or the receiver if it is not a collection (page tree).
 PDPage getFirstPage()
          Get the first page (leaf node) within the receiver hierarchy.
 PDAnnotation getLastAnnotation()
          The last PDAnnotation linked on this page.
 PDPageNode getLastNode()
          Get the last node within the receiver or the receiver if it is not a collection (page tree).
 PDPage getLastPage()
          Get the last page (leaf node) within the receiver hierarchy.
 PDAnnotation getNextAnnotation(PDAnnotation annot)
          The PDAnnotation following the given PDAnnotation annot or null, if annot was the last one in the list or does't exist on this page.
 PDPage getNextPage()
          The next page after the receiver.
 PDPage getPageAt(int index)
          The page at index within the receivers subtree.
 PDAnnotation getPreviousAnnotation(PDAnnotation annot)
          Returns the PDAnnotation preceding the given PDAnnotation annot or null, if annot was the first one in the list or does't exist on this page.
 PDPage getPreviousPage()
          Get the previous page before the receiver.
 PDResources getResources()
          return a PDCResourceDict. this is a wrapper around a COSDictionary that handles Resource specific details.
 Set getSupportedTriggerEvents()
           
 void invalidateCaches()
          Invalidate all local caches as the base object may have changed.
 boolean isPage()
          Answer true if this is a single page node.
 void removeAnnotation(PDAnnotation annot)
          Remove a PDAnnotation from the page.
 void removeApplicationData(String name)
          Remove the PDApplicationData associated with name from this page.
 void setAdditionalActions(PDAdditionalActions actions)
           
 void setApplicationData(String name, PDApplicationData data)
          Associate a PDApplicationData instance with this using name.
 void setContentStream(CSContent contentStream)
          Assign a new visual appearance to the page.
 void setResources(PDResources resources)
           
 
Methods inherited from class de.intarsys.pdf.pd.PDPageNode
getCropBox, getGenericParent, getMediaBox, getNextNode, getNodeIndex, getParent, getPreviousNode, getRotate, setCropBox, setGenericParent, setMediaBox, setRotate
 
Methods inherited from class de.intarsys.pdf.pd.PDObject
cosGetFieldDescendant, cosGetFieldInheritable, cosGetFieldInherited, cosGetSubtype, cosGetType, cosRemoveFieldInheritable, cosSetFieldInheritable, cosSetSubtype, cosSetType, getDoc, getGenericChildren, toString
 
Methods inherited from class de.intarsys.pdf.cos.COSBasedObject
changed, cosGetArray, cosGetDict, cosGetDoc, cosGetField, cosGetObject, cosGetStream, cosHasField, cosRemoveField, cosSetField, getAttribute, getFieldBoolean, getFieldDate, getFieldFixed, getFieldFixedArray, getFieldInt, getFieldMLString, getFieldString, removeAttribute, setAttribute, setFieldBoolean, setFieldFixed, setFieldInt, setFieldMLString, setFieldName, setFieldObject, setFieldString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

META

public static final PDPage.MetaClass META
The meta class instance


COPY_SUFFIX

public static String COPY_SUFFIX

DK_Annots

public static final COSName DK_Annots

DK_PieceInfo

public static final COSName DK_PieceInfo

DK_Resources

public static final COSName DK_Resources

DK_MediaBox

public static final COSName DK_MediaBox

DK_CropBox

public static final COSName DK_CropBox

DK_Contents

public static final COSName DK_Contents

DK_Metadata

public static final COSName DK_Metadata

PAGE_ACTION_TRIGGERS

public static final Set PAGE_ACTION_TRIGGERS
supported additional action triggers

Method Detail

addAnnotation

public void addAnnotation(PDAnnotation annot)
Add a PDAnnotation to the collection of annotations on the receiver page.

Parameters:
annot - The PDAnnotation to add to the page.

addContentStream

public void addContentStream(CSContent contentStream)
Add a CSContent stream to this.

Parameters:
contentStream - The new CSContent

cosAddContents

public void cosAddContents(COSStream content)
Append COSStream to the pages content

Parameters:
content - The COSStream to add to the page

cosPrependContents

public void cosPrependContents(COSStream content)
Prepend contents to the pages content.

Parameters:
content - The COSStream to add to the page

cosGetContents

public COSObject cosGetContents()
The /Contents entry

Returns:
The /Contents entry

cosGetPieceInfo

public COSDictionary cosGetPieceInfo()
The piece info dictionary of the document.

Returns:
The piece info dictionary of the document.

cosSetContents

public COSObject cosSetContents(COSObject content)
Set the /Contents for the page

Parameters:
content - the stream defining the page content
Returns:
The /Contents entry previously associated with this.

cosSetPieceInfo

public COSDictionary cosSetPieceInfo(COSDictionary dict)
Set the piece info dictionary of the document.

Parameters:
dict - The piece info dictionary of the document.
Returns:
The /PieceInfo entry previously associated with this.

dispose

public void dispose()
Overrides:
dispose in class PDPageNode

getAdditionalActions

public PDAdditionalActions getAdditionalActions()
Specified by:
getAdditionalActions in interface IAdditionalActionSupport

getAnnotations

public List getAnnotations()
Get a list of all PDAnnotation objects that are referenced in this page.

Returns:
A list of all PDAnnotation objects that are referenced in this page or null if none exist.

getApplicationData

public PDApplicationData getApplicationData(String name)
The PDApplicationData associated with name on the page.

Parameters:
name - The name of the PDApplicationData to lookup.
Returns:
The PDApplicationData associated with name on the page.

getContentStream

public CSContent getContentStream()
The CSContent defining the visual content of the page.

Specified by:
getContentStream in interface IContentStreamProvider
Returns:
The CSContent defining the visual content of the page.

getCount

public int getCount()
Description copied from class: PDPageNode
The total number of pages represented by this node.

Specified by:
getCount in class PDPageNode
Returns:
The total number of pages represented by this node.

getFirstAnnotation

public PDAnnotation getFirstAnnotation()
Description copied from class: PDPageNode
The first PDAnnotation linked on this page.

Overrides:
getFirstAnnotation in class PDPageNode
Returns:
The first PDAnnotation on the page or null

getFirstNode

public PDPageNode getFirstNode()
Description copied from class: PDPageNode
Get the first node within the receiver or the receiver if it is not a collection (page tree).

This may return null if the receiver is an empty collection.

Specified by:
getFirstNode in class PDPageNode
Returns:
Get the first node within the receiver or the receiver if it is not a collection (page tree).

getFirstPage

public PDPage getFirstPage()
Description copied from class: PDPageNode
Get the first page (leaf node) within the receiver hierarchy.

Specified by:
getFirstPage in class PDPageNode
Returns:
Get the first page (leaf node) within the receiver hierarchy.

getLastAnnotation

public PDAnnotation getLastAnnotation()
Description copied from class: PDPageNode
The last PDAnnotation linked on this page.

Overrides:
getLastAnnotation in class PDPageNode
Returns:
The last PDAnnotation on the page or null

getLastNode

public PDPageNode getLastNode()
Description copied from class: PDPageNode
Get the last node within the receiver or the receiver if it is not a collection (page tree).

This may return null if the receiver is an empty collection.

Specified by:
getLastNode in class PDPageNode
Returns:
Get the last node within the receiver or the receiver if it is not a collection (page tree).

getLastPage

public PDPage getLastPage()
Description copied from class: PDPageNode
Get the last page (leaf node) within the receiver hierarchy.

Overrides:
getLastPage in class PDPageNode
Returns:
Get the last page (leaf node) within the receiver hierarchy.

getNextAnnotation

public PDAnnotation getNextAnnotation(PDAnnotation annot)
The PDAnnotation following the given PDAnnotation annot or null, if annot was the last one in the list or does't exist on this page.

Parameters:
annot - a PDAnnotation
Returns:
a PDAnnotation or null

getNextPage

public PDPage getNextPage()
The next page after the receiver.

Returns:
The next page after the receiver.

getPageAt

public PDPage getPageAt(int index)
Description copied from class: PDPageNode
The page at index within the receivers subtree.

Overrides:
getPageAt in class PDPageNode
Parameters:
index - The page index
Returns:
The page at index within the receivers subtree.

getPreviousAnnotation

public PDAnnotation getPreviousAnnotation(PDAnnotation annot)
Returns the PDAnnotation preceding the given PDAnnotation annot or null, if annot was the first one in the list or does't exist on this page.

Parameters:
annot - a PDAnnotation
Returns:
a PDAnnotation or null

getPreviousPage

public PDPage getPreviousPage()
Get the previous page before the receiver.

Returns:
Get the previous page before the receiver.

getResources

public PDResources getResources()
return a PDCResourceDict. this is a wrapper around a COSDictionary that handles Resource specific details.

Specified by:
getResources in interface IResourcesProvider
Returns:
the resource dict as a PDCResourceDict

getSupportedTriggerEvents

public Set getSupportedTriggerEvents()
Specified by:
getSupportedTriggerEvents in interface IAdditionalActionSupport

invalidateCaches

public void invalidateCaches()
Description copied from class: COSBasedObject
Invalidate all local caches as the base object may have changed.

Overrides:
invalidateCaches in class PDPageNode

isPage

public boolean isPage()
Description copied from class: PDPageNode
Answer true if this is a single page node.

Specified by:
isPage in class PDPageNode
Returns:
Answer true if this is a single page node.

removeAnnotation

public void removeAnnotation(PDAnnotation annot)
Remove a PDAnnotation from the page.

Parameters:
annot - The PDAnnotation to remove from the page.

removeApplicationData

public void removeApplicationData(String name)
Remove the PDApplicationData associated with name from this page.

Parameters:
name - The name of the application data object to be removed.

setAdditionalActions

public void setAdditionalActions(PDAdditionalActions actions)
Specified by:
setAdditionalActions in interface IAdditionalActionSupport

setApplicationData

public void setApplicationData(String name,
                               PDApplicationData data)
Associate a PDApplicationData instance with this using name.

Parameters:
name - The name for the PDApplicationData instance within this.
data - The PDApplicationData instance.

setContentStream

public void setContentStream(CSContent contentStream)
Assign a new visual appearance to the page.

Specified by:
setContentStream in interface IContentStreamProvider
Parameters:
contentStream - The new visual appearance.

setResources

public void setResources(PDResources resources)
Specified by:
setResources in interface IResourcesProvider

intarsys PDF library API

Copyright © 2006 intarsys consulting GmbH. All Rights Reserved.