|
fop 1.0 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.apache.fop.render.AbstractRenderer
org.apache.fop.render.PrintRenderer
org.apache.fop.render.AbstractPathOrientedRenderer
org.apache.fop.render.ps.PSRenderer
Renderer that renders to PostScript.
This class currently generates PostScript Level 2 code. The only exception
is the FlateEncode filter which is a Level 3 feature. The filters in use
are hardcoded at the moment.
This class follows the Document Structuring Conventions (DSC) version 3.0.
If anyone modifies this renderer please make
sure to also follow the DSC to make it simpler to programmatically modify
the generated Postscript files (ex. extract pages etc.).
This renderer inserts FOP-specific comments into the PostScript stream which
may help certain users to do certain types of post-processing of the output.
These comments all start with "%FOP".
| Field Summary | |
protected org.apache.xmlgraphics.ps.PSGenerator |
gen
The PostScript generator used to output the PostScript |
static java.lang.String |
MIME_TYPE
The MIME type for PostScript |
protected PSRenderingUtil |
psUtil
Utility class which enables all sorts of features that are not directly connected to the normal rendering process. |
| Fields inherited from class org.apache.fop.render.AbstractPathOrientedRenderer |
FOX_TRANSFORM |
| Fields inherited from class org.apache.fop.render.PrintRenderer |
embedFontInfoList, fontInfo, fontResolver |
| Fields inherited from class org.apache.fop.render.AbstractRenderer |
containingBPPosition, containingIPPosition, currentBPPosition, currentIPPosition, currentPageViewport, userAgent |
| Fields inherited from interface org.apache.fop.render.ps.PSSupportedFlavors |
LEVEL_2_FLAVORS_FORM, LEVEL_2_FLAVORS_INLINE, LEVEL_3_FLAVORS_FORM, LEVEL_3_FLAVORS_INLINE |
| Fields inherited from interface org.apache.fop.render.ps.PSConfigurationConstants |
AUTO_ROTATE_LANDSCAPE, LANGUAGE_LEVEL, OPTIMIZE_RESOURCES |
| Fields inherited from interface org.apache.fop.render.Renderer |
ROLE |
| Constructor Summary | |
PSRenderer()
|
|
| Method Summary | |
protected void |
beginTextObject()
Indicates the beginning of a text object. |
protected java.util.List |
breakOutOfStateStack()
Breaks out of the state stack to handle fixed block-containers. |
protected void |
clip()
Clip using the current path. |
protected void |
clipRect(float x,
float y,
float width,
float height)
Clip using a rectangular area. |
protected void |
closePath()
Closes the current subpath by appending a straight line segment from the current point to the starting point of the subpath. |
protected void |
comment(java.lang.String comment)
Write out a comment |
protected void |
concatenateTransformationMatrix(java.awt.geom.AffineTransform at)
Concatenates the current transformation matrix with the given one, therefore establishing a new coordinate system. |
protected void |
concatMatrix(double[] matrix)
Concats the transformations matrix. |
protected void |
concatMatrix(double a,
double b,
double c,
double d,
double e,
double f)
Concats the transformation matrix. |
protected RendererContext |
createRendererContext(int x,
int y,
int width,
int height,
java.util.Map foreignAttributes)
Creates a RendererContext for an image. |
protected void |
drawBackAndBorders(Area area,
float startx,
float starty,
float width,
float height)
Draw the background and borders. This draws the background and border traits for an area given the position. |
protected void |
drawBorderLine(float x1,
float y1,
float x2,
float y2,
boolean horz,
boolean startOrBefore,
int style,
java.awt.Color col)
Draw a border segment of an XSL-FO style border. |
protected void |
drawImage(java.lang.String uri,
java.awt.geom.Rectangle2D pos,
java.util.Map foreignAttributes)
Draw an image at the indicated location. |
protected void |
endTextObject()
Indicates the end of a text object. |
protected void |
endVParea()
Signals exit from a viewport area. Subclasses can restore transformation matrices valid before the viewport area was started. |
protected void |
fillRect(float x,
float y,
float width,
float height)
Fill a rectangular area. |
protected org.apache.xmlgraphics.ps.PSResource |
getFormForImage(java.lang.String uri)
Returns a PSResource instance representing a image as a PostScript form. |
Graphics2DAdapter |
getGraphics2DAdapter()
|
ImageAdapter |
getImageAdapter()
|
int |
getLanguageLevel()
Return the PostScript language level that the renderer produces. |
java.lang.String |
getMimeType()
Get the MIME type of the renderer. |
protected org.apache.xmlgraphics.ps.PSResource |
getPSResourceForFontKey(java.lang.String key)
Returns the PSResource for the given font key. |
protected void |
handleIOTrouble(java.io.IOException ioe)
Central exception handler for I/O exceptions. |
boolean |
isAutoRotateLandscape()
|
boolean |
isOptimizeResources()
|
protected void |
lineTo(float x,
float y)
Appends a straight line segment from the current point to (x, y). The new current point is (x, y). |
protected void |
moveTo(float x,
float y)
Moves the current point to (x, y), omitting any connecting line segment. |
protected void |
movetoCurrPosition()
Make sure the cursor is in the right place. |
void |
paintImage(java.awt.image.RenderedImage image,
RendererContext context,
int x,
int y,
int width,
int height)
Paints an image at the given position. |
void |
processOffDocumentItem(OffDocumentItem oDI)
Tells the renderer to process an item not explicitly placed on the document (e.g., PDF bookmarks). Note - not all renderers will process all off-document items. |
protected void |
renderBlockViewport(BlockViewport bv,
java.util.List children)
Renders a block viewport. |
void |
renderImage(Image image,
java.awt.geom.Rectangle2D pos)
Renders an image area. |
protected void |
renderInlineParent(InlineParent ip)
Render the given InlineParent. |
void |
renderLeader(Leader area)
Render the given Leader. |
void |
renderPage(PageViewport page)
Tells the renderer to render a particular page. A renderer typically reponds by packing up the current page and writing it immediately to the output device. |
protected void |
renderRegionViewport(RegionViewport port)
Renders a region viewport. The region may clip the area and it establishes a position from where the region is placed. |
protected void |
renderSpace(SpaceArea space)
Render the given SpaceArea. |
void |
renderText(TextArea area)
Render the given TextArea. |
protected void |
renderWord(WordArea word)
Render the given WordArea. |
void |
restoreGraphicsState()
Restores the last graphics state of the rendering engine. |
protected void |
restoreStateStackAfterBreakOut(java.util.List breakOutList)
Restores the state stack after a break out. |
protected void |
rmoveTo(float x,
float y)
Moves the current point by (x, y) relative to the current position, omitting any connecting line segment. |
void |
saveGraphicsState()
Saves the graphics state of the rendering engine. |
void |
setAutoRotateLandscape(boolean value)
Sets the landscape mode for this renderer. |
void |
setDSCCompliant(boolean dscCompliant)
Sets whether or not PostScript Document Structuring Conventions (dsc) compliance are enforced. |
void |
setLanguageLevel(int level)
Sets the PostScript language level that the renderer should produce. |
void |
setOptimizeResources(boolean value)
Sets the resource optimization mode. |
void |
setSafeSetPageDevice(boolean safeSetPageDevice)
Sets whether or not the safe set page device macro should be used (as opposed to directly invoking setpagedevice) when setting the postscript page device. |
void |
setUserAgent(FOUserAgent agent)
Set the User Agent. |
void |
startRenderer(java.io.OutputStream outputStream)
Initiates the rendering phase. This must only be called once for a rendering. If stopRenderer is called then this may be called again for a new document rendering. |
protected void |
startVParea(CTM ctm,
java.awt.geom.Rectangle2D clippingRect)
Establishes a new viewport area. |
void |
stopRenderer()
Signals the end of the rendering phase. The renderer should reset to an initial state and dispose of any resources for the completed rendering. |
protected void |
updateColor(java.awt.Color col,
boolean fill)
Establishes a new foreground or fill color. |
protected void |
useFont(java.lang.String key,
int size)
Changes the currently used font. |
protected void |
writeln(java.lang.String cmd)
Write out a command |
| Methods inherited from class org.apache.fop.render.AbstractPathOrientedRenderer |
drawBackAndBorders, drawBackground, drawBorders, drawBorders, drawImage, establishTransformationMatrix, handleBlockTraits, handleRegionTraits, renderFlow, renderForeignObject, renderInlineAreaBackAndBorders, renderReferenceArea, renderTextDecoration, renderViewport |
| Methods inherited from class org.apache.fop.render.PrintRenderer |
addFontList, getFontFromArea, getFontInfo, getFontList, getFontResolver, getInternalFontNameForArea, instantiateRendererContext, renderDocument, setFontList, setupFontInfo |
| Methods inherited from class org.apache.fop.render.AbstractRenderer |
convertTitleToString, getCurrentPageViewport, getUserAgent, mptToPt, preparePage, ptToMpt, renderBeforeFloat, renderBlock, renderBlocks, renderBodyRegion, renderContainer, renderFootnote, renderInlineArea, renderInlineBlockParent, renderInlineSpace, renderLineArea, renderMainReference, renderPageAreas, renderRegion, renderXML, startPageSequence, startPageSequence, supportsOutOfOrder |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String MIME_TYPE
protected org.apache.xmlgraphics.ps.PSGenerator gen
protected PSRenderingUtil psUtil
| Constructor Detail |
public PSRenderer()
| Method Detail |
public void setUserAgent(FOUserAgent agent)
setUserAgent in interface RenderersetUserAgent in class AbstractRendererpublic void setAutoRotateLandscape(boolean value)
value - false will normally generate a "pseudo-portrait" page, true will rotate
a "wider-than-long" page by 90 degrees.public boolean isAutoRotateLandscape()
public void setLanguageLevel(int level)
level - the language level (currently allowed: 2 or 3)public int getLanguageLevel()
public void setOptimizeResources(boolean value)
value - true to enable the resource optimizationpublic boolean isOptimizeResources()
public Graphics2DAdapter getGraphics2DAdapter()
getGraphics2DAdapter in interface RenderergetGraphics2DAdapter in class AbstractRendererpublic ImageAdapter getImageAdapter()
getImageAdapter in interface RenderergetImageAdapter in class AbstractRendererprotected void writeln(java.lang.String cmd)
cmd - PostScript commandprotected void handleIOTrouble(java.io.IOException ioe)
ioe - IOException to handleprotected void comment(java.lang.String comment)
comment - Comment to writeprotected void movetoCurrPosition()
protected void clip()
clip in class AbstractPathOrientedRenderer
protected void clipRect(float x,
float y,
float width,
float height)
clipRect in class AbstractPathOrientedRendererx - the x coordinate (in points)y - the y coordinate (in points)width - the width of the rectangle (in points)height - the height of the rectangle (in points)
protected void moveTo(float x,
float y)
moveTo in class AbstractPathOrientedRendererx - x coordinatey - y coordinate
protected void rmoveTo(float x,
float y)
x - x coordinatey - y coordinate
protected void lineTo(float x,
float y)
lineTo in class AbstractPathOrientedRendererx - x coordinatey - y coordinateprotected void closePath()
closePath in class AbstractPathOrientedRenderer
protected void fillRect(float x,
float y,
float width,
float height)
fillRect in class AbstractPathOrientedRendererx - the x coordinatey - the y coordinatewidth - the width of the rectangleheight - the height of the rectangle
protected void updateColor(java.awt.Color col,
boolean fill)
updateColor in class AbstractPathOrientedRenderercol - the color to apply (null skips this operation)fill - true to set the fill color, false for the foreground color
protected void drawImage(java.lang.String uri,
java.awt.geom.Rectangle2D pos,
java.util.Map foreignAttributes)
drawImage in class AbstractPathOrientedRendereruri - the URI/URL of the imagepos - the position of the imageforeignAttributes - an optional Map with foreign attributes, may be nullprotected org.apache.xmlgraphics.ps.PSResource getFormForImage(java.lang.String uri)
uri - the image URI
public void paintImage(java.awt.image.RenderedImage image,
RendererContext context,
int x,
int y,
int width,
int height)
throws java.io.IOException
paintImage in interface ImageAdapterimage - the image which will be paintedcontext - the renderer context for the current rendererx - X position of the image (in millipoints)y - Y position of the image (in millipoints)width - width of the image (in millipoints)height - height of the image (in millipoints)
java.io.IOException - In case of an I/O error while writing the output formatpublic void saveGraphicsState()
saveGraphicsState in class AbstractPathOrientedRendererpublic void restoreGraphicsState()
restoreGraphicsState in class AbstractPathOrientedRenderer
protected void concatMatrix(double a,
double b,
double c,
double d,
double e,
double f)
a - A partb - B partc - C partd - D parte - E partf - F partprotected void concatMatrix(double[] matrix)
matrix - Matrix to useprotected void concatenateTransformationMatrix(java.awt.geom.AffineTransform at)
concatenateTransformationMatrix in class AbstractPathOrientedRendererat - the transformation matrix to process (coordinates in points)protected org.apache.xmlgraphics.ps.PSResource getPSResourceForFontKey(java.lang.String key)
key - the font key ("F*")
protected void useFont(java.lang.String key,
int size)
key - key of the font ("F*")size - font size
protected void drawBackAndBorders(Area area,
float startx,
float starty,
float width,
float height)
drawBackAndBorders in class AbstractPathOrientedRendererarea - the area to get the traits fromstartx - the start x positionstarty - the start y positionwidth - the width of the areaheight - the height of the area
protected void drawBorderLine(float x1,
float y1,
float x2,
float y2,
boolean horz,
boolean startOrBefore,
int style,
java.awt.Color col)
drawBorderLine in class AbstractPathOrientedRendererx1 - starting x coordinatey1 - starting y coordinatex2 - ending x coordinatey2 - ending y coordinatehorz - true for horizontal border segments, false for vertical border segmentsstartOrBefore - true for border segments on the start or before edge,
false for end or after.style - the border style (one of Constants.EN_DASHED etc.)col - the color for the border segment
public void startRenderer(java.io.OutputStream outputStream)
throws java.io.IOException
startRenderer in interface RendererstartRenderer in class AbstractRendererjava.io.IOException
public void stopRenderer()
throws java.io.IOException
stopRenderer in interface RendererstopRenderer in class AbstractRendererjava.io.IOExceptionpublic void processOffDocumentItem(OffDocumentItem oDI)
processOffDocumentItem in interface RendererprocessOffDocumentItem in class AbstractRenderer
public void renderPage(PageViewport page)
throws java.io.IOException,
FOPException
renderPage in interface RendererrenderPage in class AbstractRendererjava.io.IOException
FOPExceptionprotected void renderRegionViewport(RegionViewport port)
The region may clip the area and it establishes a position from where the region is placed.
renderRegionViewport in class AbstractRendererport - The region viewport to be renderedprotected void beginTextObject()
beginTextObject in class AbstractPathOrientedRendererprotected void endTextObject()
endTextObject in class AbstractPathOrientedRendererpublic void renderText(TextArea area)
renderText in class AbstractRendererarea - the text to renderprotected void renderWord(WordArea word)
renderWord in class AbstractRendererword - the word to renderprotected void renderSpace(SpaceArea space)
renderSpace in class AbstractRendererspace - the space to renderprotected java.util.List breakOutOfStateStack()
breakOutOfStateStack in class AbstractPathOrientedRendererprotected void restoreStateStackAfterBreakOut(java.util.List breakOutList)
restoreStateStackAfterBreakOut in class AbstractPathOrientedRendererbreakOutList - the state stack to restore.
protected void startVParea(CTM ctm,
java.awt.geom.Rectangle2D clippingRect)
startVParea in class AbstractRendererctm - the coordinate transformation matrix to useclippingRect - the clipping rectangle if the viewport should be clipping,
null if no clipping is performed.protected void endVParea()
endVParea in class AbstractRenderer
protected void renderBlockViewport(BlockViewport bv,
java.util.List children)
renderBlockViewport in class AbstractPathOrientedRendererprotected void renderInlineParent(InlineParent ip)
renderInlineParent in class AbstractRendererip - the inline parent to renderpublic void renderLeader(Leader area)
renderLeader in class AbstractRendererarea - the leader to render
public void renderImage(Image image,
java.awt.geom.Rectangle2D pos)
renderImage in class AbstractRendererimage - The imagepos - The target position of the image
(todo) Make renderImage() protected
protected RendererContext createRendererContext(int x,
int y,
int width,
int height,
java.util.Map foreignAttributes)
createRendererContext in class PrintRendererx - the x coordinate (in millipoints)y - the y coordinate (in millipoints)width - the width of the image (in millipoints)height - the height of the image (in millipoints)foreignAttributes - a Map or foreign attributes, may be null
public java.lang.String getMimeType()
getMimeType in interface Rendererpublic void setSafeSetPageDevice(boolean safeSetPageDevice)
safeSetPageDevice - setting to false and the renderer will make a
standard "setpagedevice" call, setting to true will make a safe set page
device macro call (default is false).public void setDSCCompliant(boolean dscCompliant)
It can cause problems (unwanted PostScript subsystem initgraphics/erasepage calls) on some printers when the pagedevice is set. If this causes problems on a particular implementation then use this setting with a 'false' value to try and minimize the number of setpagedevice calls in the postscript document output.
Set this value to false if you experience unwanted blank pages in your postscript output.
dscCompliant - boolean value (default is true)
|
fop 1.0 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||