org.apache.fop.svg
Class PDFDocumentGraphics2D

org.apache.fop.svg.PDFGraphics2D
  |
  +--org.apache.fop.svg.PDFDocumentGraphics2D

public class PDFDocumentGraphics2D
extends PDFGraphics2D

This class is a wrapper for the PDFGraphics2D that is used to create a full document around the pdf rendering from PDFGraphics2D.

Version:
$Id: PDFDocumentGraphics2D.java,v 1.11.2.2 2003/02/25 15:08:11 jeremias Exp $
Author:
Keiron Liddle
See Also:
PDFGraphics2D

Fields inherited from class org.apache.fop.svg.PDFGraphics2D
currentFontName, currentFontSize, currentXPosition, currentYPosition, fontState, ovFontState, pdfDoc
 
Constructor Summary
PDFDocumentGraphics2D(boolean textAsShapes, java.io.OutputStream stream, int width, int height)
          Create a new PDFDocumentGraphics2D.
PDFDocumentGraphics2D(PDFDocumentGraphics2D g)
          This constructor supports the create method
 
Method Summary
 java.awt.Graphics create()
          Creates a new Graphics object that is a copy of this Graphics object.
 void drawString(java.lang.String s, float x, float y)
          Renders the text specified by the specified String, using the current Font and Paint attributes in the Graphics2D context.
 void finish()
          The rendering process has finished.
 FontState getFontState()
           
 PDFDocument getPDFDocument()
           
 void setBackgroundColor(java.awt.Color col)
          Set the background of the pdf document.
 void setGraphicContext(org.apache.batik.ext.awt.g2d.GraphicContext c)
           
 void setSVGDimension(float w, float h)
          Set the dimensions of the svg document that will be drawn.
 
Methods inherited from class org.apache.fop.svg.PDFGraphics2D
addJpegImage, addLink, applyColor, applyPaint, applyStroke, buildBufferedImage, copyArea, dispose, doDrawing, draw, drawImage, drawImage, drawRenderableImage, drawRenderedImage, drawString, fill, getAnnotList, getDeviceConfiguration, getFontMetrics, getString, setOverrideFontState, setXORMode, writeClip
 

Constructor Detail

PDFDocumentGraphics2D

public PDFDocumentGraphics2D(boolean textAsShapes,
                             java.io.OutputStream stream,
                             int width,
                             int height)
                      throws FOPException
Create a new PDFDocumentGraphics2D. This is used to create a new pdf document of the given height and width. The resulting document is written to the stream after rendering.
Parameters:
textAsShapes - set this to true so that text will be rendered using curves and not the font.
stream - the stream that the final document should be written to.
width - the width of the document
height - the height of the document

PDFDocumentGraphics2D

public PDFDocumentGraphics2D(PDFDocumentGraphics2D g)
This constructor supports the create method
Method Detail

getFontState

public FontState getFontState()

getPDFDocument

public PDFDocument getPDFDocument()

setSVGDimension

public void setSVGDimension(float w,
                            float h)
Set the dimensions of the svg document that will be drawn. This is useful if the dimensions of the svg document are different from the pdf document that is to be created. The result is scaled so that the svg fits correctly inside the pdf document.

setBackgroundColor

public void setBackgroundColor(java.awt.Color col)
Set the background of the pdf document. This is used to set the background for the pdf document Rather than leaving it as the default white.

finish

public void finish()
            throws java.io.IOException
The rendering process has finished. This should be called after the rendering has completed as there is no other indication it is complete. This will then write the results to the output stream.

setGraphicContext

public void setGraphicContext(org.apache.batik.ext.awt.g2d.GraphicContext c)
Overrides:
setGraphicContext in class PDFGraphics2D

create

public java.awt.Graphics create()
Creates a new Graphics object that is a copy of this Graphics object.
Overrides:
create in class PDFGraphics2D
Returns:
a new graphics context that is a copy of this graphics context.

drawString

public void drawString(java.lang.String s,
                       float x,
                       float y)
Description copied from class: PDFGraphics2D
Renders the text specified by the specified String, using the current Font and Paint attributes in the Graphics2D context. The baseline of the first character is at position (xy) in the User Space. The rendering attributes applied include the Clip, Transform, Paint, Font and Composite attributes. For characters in script systems such as Hebrew and Arabic, the glyphs can be rendered from right to left, in which case the coordinate supplied is the location of the leftmost character on the baseline.
Overrides:
drawString in class PDFGraphics2D
Following copied from class: org.apache.fop.svg.PDFGraphics2D
Parameters:
s - the String to be rendered
x, y - the coordinates where the String should be rendered
See Also:
#setPaint, Graphics.setColor(java.awt.Color), Graphics.setFont(java.awt.Font), #setTransform, #setComposite, #setClip


Copyright ? 1999-2003 Apache Software Foundation. All Rights Reserved.