|
fop 0.95 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Graphics
java.awt.Graphics2D
org.apache.xmlgraphics.java2d.AbstractGraphics2D
org.apache.fop.svg.PDFGraphics2D
org.apache.fop.svg.PDFDocumentGraphics2D
public class PDFDocumentGraphics2D
This class is a wrapper for the PDFGraphics2D that is used to create a full document around the pdf rendering from PDFGraphics2D.
PDFGraphics2D
Field Summary | |
---|---|
static int |
DEFAULT_NATIVE_DPI
Default device resolution (300dpi is a resonable quality for most purposes) |
protected java.awt.Shape |
initialClip
Initial clipping area, used to restore to original setting when a new page is started. |
protected java.awt.geom.AffineTransform |
initialTransform
Initial transformation matrix, used to restore to original setting when a new page is started. |
static int |
NORMAL_PDF_RESOLUTION
Normal PDF resolution (72dpi) |
Fields inherited from class org.apache.fop.svg.PDFGraphics2D |
---|
baseLevel, currentFontName, currentFontSize, currentStream, fontInfo, graphicsState, nativeCount, outputStream, ovFontState, pageRef, pdfDoc, resourceContext |
Fields inherited from class org.apache.xmlgraphics.java2d.AbstractGraphics2D |
---|
gc, inPossibleRecursion, textAsShapes |
Constructor Summary | |
---|---|
PDFDocumentGraphics2D()
Create a new PDFDocumentGraphics2D. |
|
PDFDocumentGraphics2D(boolean textAsShapes)
Create a new PDFDocumentGraphics2D. |
|
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 | |
---|---|
protected void |
closePage()
Closes the current page and adds it to the PDF file. |
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)
Draw a string to the pdf document. |
void |
finish()
The rendering process has finished. |
float |
getDeviceDPI()
|
FontInfo |
getFontInfo()
Get the font info for this pdf document. |
PDFContext |
getPDFContext()
Return the PDFContext for this instance. |
PDFDocument |
getPDFDocument()
Get the pdf document created by this class. |
void |
nextPage()
Is called to prepare the PDFDocumentGraphics2D for the next page to be painted. |
protected void |
preparePainting()
This method is used by PDFDocumentGraphics2D to prepare a new page if necessary. |
void |
setBackgroundColor(java.awt.Color col)
Set the background of the pdf document. |
void |
setDeviceDPI(float deviceDPI)
Set the device resolution for rendering. |
void |
setFontInfo(FontInfo fontInfo)
Sets the font info for this PDF document. |
void |
setSVGDimension(float w,
float h)
Set the dimensions of the svg document that will be drawn. |
void |
setupDefaultFontInfo()
Setup a default FontInfo instance if none has been setup before. |
void |
setupDocument(java.io.OutputStream stream,
int width,
int height)
Setup the document. |
protected void |
startPage()
Called to prepare a new page |
Methods inherited from class org.apache.xmlgraphics.java2d.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 |
Field Detail |
---|
public static final int NORMAL_PDF_RESOLUTION
public static final int DEFAULT_NATIVE_DPI
protected java.awt.Shape initialClip
protected java.awt.geom.AffineTransform initialTransform
Constructor Detail |
---|
public PDFDocumentGraphics2D(boolean textAsShapes)
textAsShapes
- set this to true so that text will be rendered
using curves and not the font.public PDFDocumentGraphics2D(boolean textAsShapes, java.io.OutputStream stream, int width, int height) throws java.io.IOException
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 documentheight
- the height of the document
java.io.IOException
- an io exception if there is a problem
writing to the output streampublic PDFDocumentGraphics2D()
public PDFDocumentGraphics2D(PDFDocumentGraphics2D g)
g
- the pdf document graphics to make a copy ofMethod Detail |
---|
public void setupDocument(java.io.OutputStream stream, int width, int height) throws java.io.IOException
stream
- the output stream to write the documentwidth
- the width of the pageheight
- the height of the page
java.io.IOException
- an io exception if there is a problem
writing to the output streampublic void setupDefaultFontInfo()
public void setDeviceDPI(float deviceDPI)
deviceDPI
- the device resolution (in dpi)public float getDeviceDPI()
public void setFontInfo(FontInfo fontInfo)
fontInfo
- the font info object with all the fontspublic FontInfo getFontInfo()
public PDFDocument getPDFDocument()
public PDFContext getPDFContext()
public void setSVGDimension(float w, float h)
w
- the width of the pageh
- the height of the pagepublic void setBackgroundColor(java.awt.Color col)
col
- the background colour to fillpublic void nextPage()
protected void closePage()
protected void preparePainting()
preparePainting
in class PDFGraphics2D
protected void startPage() throws java.io.IOException
java.io.IOException
- if starting the new page fails due to I/O errors.public void finish() throws java.io.IOException
java.io.IOException
- an io exception if there is a problem
writing to the output streampublic java.awt.Graphics create()
Graphics
object that is
a copy of this Graphics
object.
create
in class PDFGraphics2D
public void drawString(java.lang.String s, float x, float y)
drawString
in class PDFGraphics2D
s
- the string to drawx
- the x positiony
- the y positionAbstractGraphics2D.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)
|
fop 0.95 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |