org.apache.fop.render.afp.modca

Class AFPDataStream


public class AFPDataStream
extends java.lang.Object

A data stream is a continuous ordered stream of data elements and objects conforming to a given format. Application programs can generate data streams destined for a presentation service, archive library, presentation device or another application program. The strategic presentation data stream architectures used is Mixed Object Document Content Architecture (MO:DCA�). The MO:DCA architecture defines the data stream used by applications to describe documents and object envelopes for interchange with other applications and application services. Documents defined in the MO:DCA format may be archived in a database, then later retrieved, viewed, annotated and printed in local or distributed systems environments. Presentation fidelity is accommodated by including resource objects in the documents that reference them.

Field Summary

protected static Log
log
Static logging instance

Constructor Summary

AFPDataStream()
Default constructor for the AFPDataStream.

Method Summary

void
createFont(byte 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 current page.
void
createIncludePageOverlay(String name)
Helper method which allows creation of the MPO object, via the AEG.
void
createIncludePageSegment(String name, int x, int y)
Creates an IncludePageSegment on the current page.
void
createInvokeMediumMap(String name)
Helper method which allows creation of the IMM object.
void
createLine(int x1, int y1, int x2, int y2, int thickness, Color col)
Method to create a line on the current page.
void
createNoOperation(String content)
Creates a NoOperation item
void
createPageGroupTagLogicalElement(TagLogicalElementBean[] attributes)
Creates a TagLogicalElement on the current page group.
void
createPageTagLogicalElement(TagLogicalElementBean[] attributes)
Creates a TagLogicalElement on the current page.
void
createShading(int x, int y, int w, int h, int red, int green, int blue)
This method will create shading on the page using the specified coordinates (the shading contrast is controlled via the red, green, blue parameters, by converting this to grey scale).
void
createTagLogicalElement(String name, String value)
Creates a TagLogicalElement on the current page or page group
void
createText(int fontNumber, int x, int y, Color col, int vsci, int ica, byte[] data)
Helper method to create text on the current page, this method delegates to the current presentation text object in order to construct the text.
void
endDocument()
The document is ended by invoking this method which creates an instance of the AFP Document object and registers the start with a validation map which ensures that methods are not invoked out of the correct sequence.
void
endOverlay()
Helper method to mark the end of the current overlay.
void
endPage()
Helper method to mark the end of the current page.
void
endPageGroup()
Helper method to mark the end of the page group.
ImageObject
getImageObject(int x, int y, int w, int h, int wr, int hr)
Returns an ImageObject used to create an image in the datastream.
void
restorePage(PageObject pageObject)
Helper method to restore the current page.
PageObject
savePage()
Helper method to save the current page.
void
setLandscapeRotation(int pageRotation)
Sets the rotation to be used for landscape pages, valid values are 0, 90, 180, 270 (default).
void
setOffsets(int xOff, int yOff, int rot)
Sets the offsets to be used for element positioning
void
setPortraitRotation(int pageRotation)
Sets the rotation to be used for portrait pages, valid values are 0 (default), 90, 180, 270.
void
startDocument(OutputStream docOutputStream)
The document is started by invoking this method which creates an instance of the AFP Document object.
void
startOverlay(int overlayX, int overlayY, int overlayWidth, int overlayHeight, int overlayWidthResolution, int overlayHeightResolution, int overlayRotation)
Start a new overlay.
void
startPage(int pageWidth, int pageHeight, int pageRotation, int pageWidthResolution, int pageHeightResolution)
Start a new page.
void
startPageGroup()
Start a new page group.

Field Details

log

protected static Log log
Static logging instance

Constructor Details

AFPDataStream

public AFPDataStream()
Default constructor for the AFPDataStream.

Method Details

createFont

public void createFont(byte 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 current page.
Parameters:
fontReference - the font number used as the resource identifier
font - the font
size - the point size of the font

createIncludePageOverlay

public void createIncludePageOverlay(String name)
Helper method which allows creation of the MPO object, via the AEG. And the IPO via the Page. (See actual object for descriptions.)
Parameters:
name - the name of the static overlay

createIncludePageSegment

public void createIncludePageSegment(String name,
                                     int x,
                                     int y)
Creates an IncludePageSegment on the current page.
Parameters:
name - the name of the include page segment
x - the x coordinate for the overlay
y - the y coordinate for the overlay

createInvokeMediumMap

public void createInvokeMediumMap(String name)
Helper method which allows creation of the IMM object.
Parameters:
name - the name of the medium map

createLine

public void createLine(int x1,
                       int y1,
                       int x2,
                       int y2,
                       int thickness,
                       Color col)
Method to create a line on the current page.
Parameters:
x1 - the first x coordinate of the line
y1 - the first y coordinate of the line
x2 - the second x coordinate of the line
y2 - the second y coordinate of the line
thickness - the thickness of the line
col - The text color.

createNoOperation

public void createNoOperation(String content)
Creates a NoOperation item
Parameters:
content - byte data

createPageGroupTagLogicalElement

public void createPageGroupTagLogicalElement(TagLogicalElementBean[] attributes)
Creates a TagLogicalElement on the current page group.
Parameters:
attributes - the array of key value pairs.

createPageTagLogicalElement

public void createPageTagLogicalElement(TagLogicalElementBean[] attributes)
Creates a TagLogicalElement on the current page.
Parameters:
attributes - the array of key value pairs.

createShading

public void createShading(int x,
                          int y,
                          int w,
                          int h,
                          int red,
                          int green,
                          int blue)
This method will create shading on the page using the specified coordinates (the shading contrast is controlled via the red, green, blue parameters, by converting this to grey scale).
Parameters:
x - the x coordinate of the shading
y - the y coordinate of the shading
w - the width of the shaded area
h - the height of the shaded area
red - the red value
green - the green value
blue - the blue value

createTagLogicalElement

public void createTagLogicalElement(String name,
                                    String value)
Creates a TagLogicalElement on the current page or page group
Parameters:
name - The tag name
value - The tag value

createText

public void createText(int fontNumber,
                       int x,
                       int y,
                       Color col,
                       int vsci,
                       int ica,
                       byte[] data)
Helper method to create text on the current page, this method delegates to the current presentation text object in order to construct the text.
Parameters:
fontNumber - the font number used as the resource identifier
x - the x coordinate of the text
y - the y coordinate of the text
col - the text color
vsci - The variable space character increment.
ica - The inter character adjustment.
data - the text data to create

endDocument

public void endDocument()
            throws IOException
The document is ended by invoking this method which creates an instance of the AFP Document object and registers the start with a validation map which ensures that methods are not invoked out of the correct sequence.

endOverlay

public void endOverlay()
Helper method to mark the end of the current overlay.

endPage

public void endPage()
            throws IOException
Helper method to mark the end of the current page.

endPageGroup

public void endPageGroup()
            throws IOException
Helper method to mark the end of the page group.

getImageObject

public ImageObject getImageObject(int x,
                                  int y,
                                  int w,
                                  int h,
                                  int wr,
                                  int hr)
Returns an ImageObject used to create an image in the datastream.
Parameters:
x - the x position of the image
y - the y position of the image
w - the width of the image
h - the height of the image
wr - the width resolution of the image
hr - the height resolution of the image
Returns:
ImageObject used to create an image in the datastream

restorePage

public void restorePage(PageObject pageObject)
Helper method to restore the current page.
Parameters:
pageObject - page object

savePage

public PageObject savePage()
Helper method to save the current page.
Returns:
current page object that was saved

setLandscapeRotation

public void setLandscapeRotation(int pageRotation)
Sets the rotation to be used for landscape pages, valid values are 0, 90, 180, 270 (default).
Parameters:
pageRotation - The rotation in degrees.

setOffsets

public void setOffsets(int xOff,
                       int yOff,
                       int rot)
Sets the offsets to be used for element positioning
Parameters:
xOff - the offset in the x direction
yOff - the offset in the y direction
rot - the rotation

setPortraitRotation

public void setPortraitRotation(int pageRotation)
Sets the rotation to be used for portrait pages, valid values are 0 (default), 90, 180, 270.
Parameters:
pageRotation - The rotation in degrees.

startDocument

public void startDocument(OutputStream docOutputStream)
The document is started by invoking this method which creates an instance of the AFP Document object.
Parameters:
docOutputStream - the outputStream which the document is written to.

startOverlay

public void startOverlay(int overlayX,
                         int overlayY,
                         int overlayWidth,
                         int overlayHeight,
                         int overlayWidthResolution,
                         int overlayHeightResolution,
                         int overlayRotation)
Parameters:
overlayX - the x position of the overlay on the page
overlayY - the y position of the overlay on the page
overlayWidth - the width of the overlay
overlayHeight - the height of the overlay
overlayWidthResolution - the width resolution of the overlay
overlayHeightResolution - the height resolution of the overlay
overlayRotation - the rotation of the overlay

startPage

public void startPage(int pageWidth,
                      int pageHeight,
                      int pageRotation,
                      int pageWidthResolution,
                      int pageHeightResolution)
Parameters:
pageWidth - the width of the page
pageHeight - the height of the page
pageRotation - the rotation of the page
pageWidthResolution - the width resolution of the page
pageHeightResolution - the height resolution of the page

startPageGroup

public void startPageGroup()

Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.