org.apache.fop.svg
Class PDFDocumentGraphics2D

java.lang.Object
  extended by java.awt.Graphics
      extended by java.awt.Graphics2D
          extended by org.apache.batik.ext.awt.g2d.AbstractGraphics2D
              extended by org.apache.fop.svg.PDFGraphics2D
                  extended by org.apache.fop.svg.PDFDocumentGraphics2D
All Implemented Interfaces:
Cloneable

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

Field Summary
 
Fields inherited from class org.apache.fop.svg.PDFGraphics2D
currentFontName, currentFontSize, currentXPosition, currentYPosition, fontState, ovFontState, pdfDoc
 
Fields inherited from class org.apache.batik.ext.awt.g2d.AbstractGraphics2D
gc, textAsShapes
 
Constructor Summary
PDFDocumentGraphics2D(boolean textAsShapes, OutputStream stream, int width, int height)
          Create a new PDFDocumentGraphics2D.
PDFDocumentGraphics2D(PDFDocumentGraphics2D g)
          This constructor supports the create method
 
Method Summary
 Graphics create()
          Creates a new Graphics object that is a copy of this Graphics object.
 void drawString(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(Color col)
          Set the background of the pdf document.
 void setGraphicContext(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
 
Methods inherited from class org.apache.batik.ext.awt.g2d.AbstractGraphics2D
addRenderingHints, clearRect, clip, clipRect, drawArc, drawGlyphVector, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawLine, drawOval, drawPolygon, drawPolyline, drawRect, drawRoundRect, drawString, drawString, fillArc, fillOval, fillPolygon, fillRect, fillRoundRect, getBackground, getClip, getClipBounds, getColor, getComposite, getFont, getFontRenderContext, getGraphicContext, getPaint, getRenderingHint, getRenderingHints, getStroke, getTransform, hit, rotate, rotate, scale, setBackground, setClip, setClip, setColor, setComposite, setFont, setPaint, setPaintMode, setRenderingHint, setRenderingHints, setStroke, setTransform, shear, transform, translate, translate
 
Methods inherited from class java.awt.Graphics2D
draw3DRect, fill3DRect
 
Methods inherited from class java.awt.Graphics
create, drawBytes, drawChars, drawPolygon, fillPolygon, finalize, getClipBounds, getClipRect, getFontMetrics, hitClip, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PDFDocumentGraphics2D

public PDFDocumentGraphics2D(boolean textAsShapes,
                             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
Throws:
FOPException

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(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 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.

Throws:
IOException

setGraphicContext

public void setGraphicContext(GraphicContext c)
Overrides:
setGraphicContext in class PDFGraphics2D

create

public 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(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
Parameters:
s - the String to be rendered
See Also:
AbstractGraphics2D.setPaint(java.awt.Paint), Graphics.setColor(java.awt.Color), Graphics.setFont(java.awt.Font), AbstractGraphics2D.setTransform(java.awt.geom.AffineTransform), AbstractGraphics2D.setComposite(java.awt.Composite), AbstractGraphics2D.setClip(int, int, int, int)


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