org.apache.fop.render.ps
Class PSRenderer

java.lang.Object
  |
  +--org.apache.fop.render.AbstractRenderer
        |
        +--org.apache.fop.render.ps.PSRenderer
All Implemented Interfaces:
Renderer

public class PSRenderer
extends AbstractRenderer

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 I did everything right). 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.).
TODO: Character size/spacing, SVG Transcoder for Batik, configuration, move to PrintRenderer, maybe improve filters (I'm not very proud of them), add a RunLengthEncode filter (useful for Level 2 Postscript), Improve DocumentProcessColors stuff (probably needs to be configurable, then maybe add a color to grayscale conversion for bitmaps to make output smaller (See PCLRenderer), font embedding, support different character encodings, try to implement image transparency, positioning of images is wrong etc.

Modified by Mark Lillywhite mark-fop@inomial.com, to use the new Renderer interface. This PostScript renderer appears to be the most efficient at producing output.

Author:
Jeremias Märki

Field Summary
protected  IDReferences idReferences
           
protected  java.util.Hashtable options
           
protected  PSStream out
          the stream used to output the PostScript
protected  java.lang.String producer
          the application producing the PostScript
 
Fields inherited from class org.apache.fop.render.AbstractRenderer
currentAreaContainerXPosition, currentXPosition, currentYPosition, log
 
Constructor Summary
PSRenderer()
           
 
Method Summary
protected  void addFilledRect(int x, int y, int w, int h, ColorType col)
          Add a filled rectangle to the current stream This default implementation calls addRect using the same color for fill and border.
protected  void comment(java.lang.String comment)
          write out a comment
protected  void doFrame(Area area)
           
protected  void movetoCurrPosition()
           
 void render(Page page, java.io.OutputStream outputStream)
          render the given area tree to the given stream
 void renderBitmap(FopImage img, int x, int y, int w, int h)
           
 void renderDisplaySpace(DisplaySpace space)
          render a display space to PostScript
 void renderEPS(FopImage img, int x, int y, int w, int h)
           
 void renderForeignObjectArea(ForeignObjectArea area)
          render a foreign object area
 void renderImageArea(ImageArea area)
          render an image area to PostScript
 void renderInlineSpace(InlineSpace space)
          render an inline space to PostScript
 void renderLeaderArea(LeaderArea area)
          render a leader area to PostScript
 void renderLineArea(LineArea area)
          render a line area to PostScript
 void renderPage(Page page)
          render a page to PostScript
 void renderSVGArea(SVGArea area)
          render an SVG area to PostScript
 void renderWordArea(WordArea area)
          render an inline area to PostScript
 void setOptions(java.util.Hashtable options)
          set up renderer options
 void setProducer(java.lang.String producer)
          set the document's producer
 void setupFontInfo(FontInfo fontInfo)
          set up the font info
 void startRenderer(java.io.OutputStream outputStream)
          Default start renderer method.
 void stopRenderer(java.io.OutputStream outputStream)
          Default stop renderer method.
 void useFont(java.lang.String name, int size)
           
protected  void write(java.lang.String cmd)
          write out a command
protected  void writeFontDict(FontInfo fontInfo)
           
 
Methods inherited from class org.apache.fop.render.AbstractRenderer
renderAreaContainer, renderBlockArea, renderBodyAreaContainer, renderSpanArea, setLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

producer

protected java.lang.String producer
the application producing the PostScript

out

protected PSStream out
the stream used to output the PostScript

idReferences

protected IDReferences idReferences

options

protected java.util.Hashtable options
Constructor Detail

PSRenderer

public PSRenderer()
Method Detail

setProducer

public void setProducer(java.lang.String producer)
set the document's producer
Parameters:
producer - string indicating application producing the PostScript

setOptions

public void setOptions(java.util.Hashtable options)
set up renderer options

write

protected void write(java.lang.String cmd)
write out a command

comment

protected void comment(java.lang.String comment)
write out a comment

writeFontDict

protected void writeFontDict(FontInfo fontInfo)

movetoCurrPosition

protected void movetoCurrPosition()

setupFontInfo

public void setupFontInfo(FontInfo fontInfo)
set up the font info
Parameters:
fontInfo - the font info object to set up

addFilledRect

protected void addFilledRect(int x,
                             int y,
                             int w,
                             int h,
                             ColorType col)
Description copied from class: AbstractRenderer
Add a filled rectangle to the current stream This default implementation calls addRect using the same color for fill and border.
Overrides:
addFilledRect in class AbstractRenderer
Following copied from class: org.apache.fop.render.AbstractRenderer
Parameters:
x - the x position of left edge in millipoints
y - the y position of top edge in millipoints
w - the width in millipoints
h - the height in millipoints
fill - the fill color/gradient

renderDisplaySpace

public void renderDisplaySpace(DisplaySpace space)
render a display space to PostScript
Parameters:
space - the space to render

renderForeignObjectArea

public void renderForeignObjectArea(ForeignObjectArea area)
render a foreign object area

renderSVGArea

public void renderSVGArea(SVGArea area)
render an SVG area to PostScript
Parameters:
area - the area to render

renderEPS

public void renderEPS(FopImage img,
                      int x,
                      int y,
                      int w,
                      int h)

renderBitmap

public void renderBitmap(FopImage img,
                         int x,
                         int y,
                         int w,
                         int h)

renderImageArea

public void renderImageArea(ImageArea area)
render an image area to PostScript
Parameters:
area - the area to render

renderWordArea

public void renderWordArea(WordArea area)
render an inline area to PostScript
Parameters:
area - the area to render

useFont

public void useFont(java.lang.String name,
                    int size)

renderInlineSpace

public void renderInlineSpace(InlineSpace space)
render an inline space to PostScript
Parameters:
space - the space to render

renderLineArea

public void renderLineArea(LineArea area)
render a line area to PostScript
Overrides:
renderLineArea in class AbstractRenderer
Parameters:
area - the area to render

renderPage

public void renderPage(Page page)
render a page to PostScript
Parameters:
page - the page to render

renderLeaderArea

public void renderLeaderArea(LeaderArea area)
render a leader area to PostScript
Parameters:
area - the area to render

doFrame

protected void doFrame(Area area)
Overrides:
doFrame in class AbstractRenderer

startRenderer

public void startRenderer(java.io.OutputStream outputStream)
                   throws java.io.IOException
Default start renderer method. This would normally be overridden. (mark-fop@inomial.com).

stopRenderer

public void stopRenderer(java.io.OutputStream outputStream)
                  throws java.io.IOException
Default stop renderer method. This would normally be overridden. (mark-fop@inomial.com).

render

public void render(Page page,
                   java.io.OutputStream outputStream)
Description copied from interface: Renderer
render the given area tree to the given stream


Copyright © 1999-2002 Apache Software Foundation. All Rights Reserved.