org.apache.fop.render.pdf
Class PDFRenderer

java.lang.Object
  |
  +--org.apache.fop.render.AbstractRenderer
        |
        +--org.apache.fop.render.PrintRenderer
              |
              +--org.apache.fop.render.pdf.PDFRenderer
All Implemented Interfaces:
Renderer

public class PDFRenderer
extends PrintRenderer

Renderer that renders areas to PDF Modified by Mark Lillywhite, mark-fop@inomial.com to use the new Renderer interface. The PDF renderer is by far the trickiest renderer and the best supported by FOP. It also required some reworking in the way that Pages, Catalogs and the Root object were written to the stream. The output document should now still be a 100% compatible PDF document, but hte order of the document writing is significantly different. See also the changes to PDFPage, PDFPages and PDFRoot.


Field Summary
protected  java.util.Vector extensions
           
protected  java.util.Hashtable options
          options
protected  PDFDocument pdfDoc
          the PDF Document being created
protected  PDFResources pdfResources
          the /Resources object of the PDF document being created
 
Fields inherited from class org.apache.fop.render.PrintRenderer
currentFill, currentFontName, currentFontSize, currentStroke, fontInfo, idReferences, prevLineThroughColor, prevLineThroughSize, prevLineThroughXEndPos, prevLineThroughYEndPos, prevOverlineColor, prevOverlineSize, prevOverlineXEndPos, prevOverlineYEndPos, prevUnderlineColor, prevUnderlineSize, prevUnderlineXEndPos, prevUnderlineYEndPos
 
Fields inherited from class org.apache.fop.render.AbstractRenderer
currentAreaContainerXPosition, currentXPosition, currentYPosition, log
 
Constructor Summary
PDFRenderer()
          create the PDF renderer
 
Method Summary
protected  void addFilledRect(int x, int y, int w, int h, PDFPathPaint fill)
          add a filled rectangle to the current stream
protected  void addLine(int x1, int y1, int x2, int y2, int th, int rs, PDFPathPaint stroke)
          add a line to the current stream
protected  void addLine(int x1, int y1, int x2, int y2, int th, PDFPathPaint stroke)
          add a line to the current stream
protected  void addRect(int x, int y, int w, int h, PDFPathPaint stroke)
          add a rectangle to the current stream
protected  void addRect(int x, int y, int w, int h, PDFPathPaint stroke, PDFPathPaint fill)
          add a filled rectangle to the current stream
 void render(Page page, java.io.OutputStream outputStream)
          render the given area tree to the given stream
 void renderForeignObjectArea(ForeignObjectArea area)
          render a foreign object area
 void renderImageArea(ImageArea area)
          render image area to PDF
 void renderPage(Page page)
          render page into PDF
protected  void renderRootExtensions(java.util.Vector exts)
           
 void renderSVGArea(SVGArea area)
          render SVG area to PDF
protected  void renderSVGDocument(org.w3c.dom.Document doc, int x, int y, FontState fs)
           
 void renderWordArea(WordArea area)
          render inline area to PDF
 void setOptions(java.util.Hashtable options)
          set up renderer options
 void setProducer(java.lang.String producer)
          set the PDF document's producer
 void startRenderer(java.io.OutputStream stream)
          Default start renderer method.
 void stopRenderer(java.io.OutputStream stream)
          Default stop renderer method.
 
Methods inherited from class org.apache.fop.render.PrintRenderer
addFilledRect, addWordLines, doFrame, renderDisplaySpace, renderInlineSpace, renderLeaderArea, setupFontInfo
 
Methods inherited from class org.apache.fop.render.AbstractRenderer
renderAreaContainer, renderBlockArea, renderBodyAreaContainer, renderLineArea, renderSpanArea, setLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pdfDoc

protected PDFDocument pdfDoc
the PDF Document being created

pdfResources

protected PDFResources pdfResources
the /Resources object of the PDF document being created

options

protected java.util.Hashtable options
options

extensions

protected java.util.Vector extensions
Constructor Detail

PDFRenderer

public PDFRenderer()
create the PDF renderer
Method Detail

setOptions

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

setProducer

public void setProducer(java.lang.String producer)
set the PDF document's producer
Overrides:
setProducer in class PrintRenderer
Parameters:
producer - string indicating application producing PDF

startRenderer

public void startRenderer(java.io.OutputStream stream)
                   throws java.io.IOException
Description copied from class: PrintRenderer
Default start renderer method. This would normally be overridden. (mark-fop@inomial.com).
Overrides:
startRenderer in class PrintRenderer

stopRenderer

public void stopRenderer(java.io.OutputStream stream)
                  throws java.io.IOException
Description copied from class: PrintRenderer
Default stop renderer method. This would normally be overridden. (mark-fop@inomial.com).
Overrides:
stopRenderer in class PrintRenderer

addLine

protected void addLine(int x1,
                       int y1,
                       int x2,
                       int y2,
                       int th,
                       PDFPathPaint stroke)
add a line to the current stream
Overrides:
addLine in class PrintRenderer
Parameters:
x1 - the start x location in millipoints
y1 - the start y location in millipoints
x2 - the end x location in millipoints
y2 - the end y location in millipoints
th - the thickness in millipoints
r - the red component
g - the green component
b - the blue component

addLine

protected void addLine(int x1,
                       int y1,
                       int x2,
                       int y2,
                       int th,
                       int rs,
                       PDFPathPaint stroke)
add a line to the current stream
Overrides:
addLine in class PrintRenderer
Parameters:
x1 - the start x location in millipoints
y1 - the start y location in millipoints
x2 - the end x location in millipoints
y2 - the end y location in millipoints
th - the thickness in millipoints
rs - the rule style
r - the red component
g - the green component
b - the blue component

addRect

protected void addRect(int x,
                       int y,
                       int w,
                       int h,
                       PDFPathPaint stroke)
add a rectangle to the current stream
Overrides:
addRect in class PrintRenderer
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
stroke - the stroke color/gradient

addRect

protected void addRect(int x,
                       int y,
                       int w,
                       int h,
                       PDFPathPaint stroke,
                       PDFPathPaint fill)
add a filled rectangle to the current stream
Overrides:
addRect in class PrintRenderer
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
stroke - the stroke color/gradient

addFilledRect

protected void addFilledRect(int x,
                             int y,
                             int w,
                             int h,
                             PDFPathPaint fill)
add a filled rectangle to the current stream
Overrides:
addFilledRect in class PrintRenderer
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

renderImageArea

public void renderImageArea(ImageArea area)
render image area to PDF
Overrides:
renderImageArea in class PrintRenderer
Parameters:
area - the image area to render

renderForeignObjectArea

public void renderForeignObjectArea(ForeignObjectArea area)
render a foreign object area
Overrides:
renderForeignObjectArea in class PrintRenderer

renderSVGArea

public void renderSVGArea(SVGArea area)
render SVG area to PDF
Overrides:
renderSVGArea in class PrintRenderer
Parameters:
area - the SVG area to render

renderSVGDocument

protected void renderSVGDocument(org.w3c.dom.Document doc,
                                 int x,
                                 int y,
                                 FontState fs)

renderWordArea

public void renderWordArea(WordArea area)
render inline area to PDF
Overrides:
renderWordArea in class PrintRenderer
Parameters:
area - inline area to render

render

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

renderPage

public void renderPage(Page page)
render page into PDF
Overrides:
renderPage in class PrintRenderer
Parameters:
page - page to render

renderRootExtensions

protected void renderRootExtensions(java.util.Vector exts)


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