public abstract class AbstractPageObject extends AbstractNamedAFPObject implements Completable
The page is the level in the document component hierarchy that is used for printing or displaying a document's content. The data objects contained in the page envelope in the data stream are presented when the page is presented. Each data object has layout information associated with it that directs the placement and orientation of the data on the page. In addition, each page contains layout information that specifies the measurement units, page width, and page depth.
A page is initiated by a begin page structured field and terminated by an end page structured field. Structured fields that define objects and active environment groups or that specify attributes of the page may be encountered in page state.
AbstractAFPObject.Category, AbstractAFPObject.Type
Modifier and Type | Field and Description |
---|---|
protected ActiveEnvironmentGroup |
activeEnvironmentGroup
The active environment group for the page
|
protected boolean |
complete
The page state
|
protected Factory |
factory
the object factory
|
protected java.util.List |
objects
The list of objects within this resource container
|
protected int |
rotation
The page rotation
|
name
triplets
LOG, SF_CLASS, SF_HEADER_LENGTH
Constructor and Description |
---|
AbstractPageObject(Factory factory)
Default constructor
|
AbstractPageObject(Factory factory,
java.lang.String name)
Main constructor
|
AbstractPageObject(Factory factory,
java.lang.String name,
int width,
int height,
int rotation,
int widthRes,
int heightRes)
Construct a new page object for the specified name argument, the page
name should be an 8 character identifier.
|
Modifier and Type | Method and Description |
---|---|
void |
addObject(java.lang.Object obj)
Adds an AFP object reference to this page
|
void |
createFont(int fontReference,
AFPFont font,
int size)
Helper method to create a map coded font object on the current page, this
method delegates the construction of the map coded font object to the
active environment group on the page.
|
void |
createIncludePageSegment(java.lang.String name,
int x,
int y,
boolean hard)
Creates an IncludePageSegment on the current page.
|
void |
createLine(AFPLineDataInfo lineDataInfo)
Helper method to create a line on the current page, this method delegates
to the presentation text object in order to construct the line.
|
void |
createNoOperation(java.lang.String content)
Creates a NoOperation on the page.
|
void |
createTagLogicalElement(java.lang.String name,
java.lang.String value,
int tleID)
Creates a TagLogicalElement on the page.
|
void |
createText(PtocaProducer producer)
Helper method to create text on the current page, this method delegates
to the presentation text object in order to construct the text.
|
void |
endPage()
Helper method to mark the end of the page.
|
protected void |
endPresentationObject()
Ends the presentation text object
|
ActiveEnvironmentGroup |
getActiveEnvironmentGroup()
Returns the ActiveEnvironmentGroup associated with this page.
|
int |
getHeight()
Returns the height of the page
|
PresentationTextObject |
getPresentationTextObject()
Helper method to create a presentation text object
on the current page and to return the object.
|
int |
getRotation()
Returns the rotation of the page
|
protected java.util.List |
getTagLogicalElements()
Returns the list of
TagLogicalElement s. |
int |
getWidth()
Returns the width of the page
|
boolean |
isComplete()
Returns true if this object is complete
|
void |
setComplete(boolean complete)
Sets whether or not this object is complete or not
|
protected void |
writeContent(java.io.OutputStream os)
Helper method to write the contents of the Object.
|
copySF, getName, getNameBytes, getNameLength, setName, toString
addTriplet, addTriplets, getFullyQualifiedName, getTripletDataLength, getTriplets, hasTriplet, hasTriplets, setComment, setFullyQualifiedName, setObjectClassification, writeTriplets
writeEnd, writeStart, writeToStream
copySF, truncate, writeChunksToStream, writeObjects
protected ActiveEnvironmentGroup activeEnvironmentGroup
protected java.util.List objects
protected int rotation
protected boolean complete
protected final Factory factory
public AbstractPageObject(Factory factory)
factory
- the object factorypublic AbstractPageObject(Factory factory, java.lang.String name)
factory
- the object factoryname
- the name of this page objectpublic AbstractPageObject(Factory factory, java.lang.String name, int width, int height, int rotation, int widthRes, int heightRes)
factory
- the object factory.name
- the name of the page.width
- the width of the page.height
- the height of the page.rotation
- the rotation of the page.widthRes
- the width resolution of the page.heightRes
- the height resolution of the page.public void createFont(int fontReference, AFPFont font, int size)
fontReference
- the font number used as the resource identifierfont
- the fontsize
- the point size of the fontpublic void createLine(AFPLineDataInfo lineDataInfo)
lineDataInfo
- the line data information.public void createText(PtocaProducer producer) throws java.io.UnsupportedEncodingException
producer
- the producerjava.io.UnsupportedEncodingException
- thrown if character encoding is not supportedpublic void endPage()
protected void endPresentationObject()
public PresentationTextObject getPresentationTextObject()
protected java.util.List getTagLogicalElements()
TagLogicalElement
s.public void createTagLogicalElement(java.lang.String name, java.lang.String value, int tleID)
name
- the name of the tagvalue
- the value of the tagtleID
- unique ID within AFP streampublic void createNoOperation(java.lang.String content)
content
- the byte datapublic void createIncludePageSegment(java.lang.String name, int x, int y, boolean hard)
name
- the name of the page segmentx
- the x coordinate of the page segment.y
- the y coordinate of the page segment.hard
- true if hard page segment possiblepublic ActiveEnvironmentGroup getActiveEnvironmentGroup()
public int getHeight()
public int getWidth()
public int getRotation()
protected void writeContent(java.io.OutputStream os) throws java.io.IOException
writeContent
in class AbstractStructuredObject
os
- The stream to write tojava.io.IOException
- throws an I/O exception if one occurredpublic void addObject(java.lang.Object obj)
obj
- an AFP objectpublic void setComplete(boolean complete)
setComplete
in interface Completable
complete
- true if this object is completepublic boolean isComplete()
isComplete
in interface Completable
Copyright 1999-2012 The Apache Software Foundation. All Rights Reserved.