public class PageDrawer extends PDFGraphicsStreamEngine
If you want to do custom graphics processing rather than Graphics2D rendering, then you should subclass PDFGraphicsStreamEngine instead. Subclassing PageDrawer is only suitable for cases where the goal is to render onto a Graphics2D surface.
| Constructor and Description |
|---|
PageDrawer(PageDrawerParameters parameters)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
appendRectangle(Point2D p0,
Point2D p1,
Point2D p2,
Point2D p3)
Append a rectangle to the current path.
|
void |
beginText()
Called when the BT operator is encountered.
|
void |
clip(int windingRule)
Modify the current clipping path by intersecting it with the current path.
|
void |
closePath()
Closes the current path.
|
void |
curveTo(float x1,
float y1,
float x2,
float y2,
float x3,
float y3)
Draws a curve from the current point to (x3,y3) using (x1,y1) and (x2,y2) as control points.
|
void |
drawImage(PDImage pdImage)
Draw the image.
|
void |
drawPage(Graphics g,
PDRectangle pageSize)
Draws the page to the requested context.
|
void |
endPath()
Ends the current path without filling or stroking it.
|
void |
endText()
Called when the ET operator is encountered.
|
void |
fillAndStrokePath(int windingRule)
Fills and then strokes the path.
|
void |
fillPath(int windingRule)
Fill the path.
|
Point2D |
getCurrentPoint()
Returns the current point of the current path.
|
protected Graphics2D |
getGraphics()
Returns the underlying Graphics2D.
|
protected GeneralPath |
getLinePath()
Returns the current line path.
|
protected Paint |
getPaint(PDColor color)
Returns an AWT paint for the given PDColor.
|
PDFRenderer |
getRenderer()
Returns the parent renderer.
|
void |
lineTo(float x,
float y)
Draws a line from the current point to (x,y).
|
void |
moveTo(float x,
float y)
Starts a new path at (x,y).
|
void |
shadingFill(COSName shadingName)
Fill with Shading.
|
void |
showAnnotation(PDAnnotation annotation)
Shows the given annotation.
|
protected void |
showFontGlyph(Matrix textRenderingMatrix,
PDFont font,
int code,
String unicode,
Vector displacement)
Called when a glyph is to be processed.This method is intended for overriding in subclasses,
the default implementation does nothing.
|
void |
showTransparencyGroup(PDTransparencyGroup form)
Shows a transparency group from the content stream.
|
void |
strokePath()
Stroke the path.
|
getPageaddOperator, applyTextAdjustment, getAppearance, getCurrentPage, getGraphicsStackSize, getGraphicsState, getInitialMatrix, getResources, getTextLineMatrix, getTextMatrix, operatorException, processAnnotation, processChildStream, processOperator, processOperator, processPage, processSoftMask, processTilingPattern, processTilingPattern, processTransparencyGroup, processType3Stream, registerOperatorProcessor, restoreGraphicsStack, restoreGraphicsState, saveGraphicsStack, saveGraphicsState, setLineDashPattern, setTextLineMatrix, setTextMatrix, showForm, showGlyph, showText, showTextString, showTextStrings, showType3Glyph, transformedPoint, transformWidth, unsupportedOperatorpublic PageDrawer(PageDrawerParameters parameters) throws IOException
parameters - Parameters for page drawing.IOException - If there is an error loading properties from the file.public final PDFRenderer getRenderer()
protected final Graphics2D getGraphics()
protected final GeneralPath getLinePath()
public void drawPage(Graphics g, PDRectangle pageSize) throws IOException
g - The graphics context to draw onto.pageSize - The size of the page to draw.IOException - If there is an IO error while drawing the page.protected Paint getPaint(PDColor color) throws IOException
IOExceptionpublic void beginText()
throws IOException
PDFStreamEnginebeginText in class PDFStreamEngineIOException - if there was an error processing the textpublic void endText()
throws IOException
PDFStreamEngineendText in class PDFStreamEngineIOException - if there was an error processing the textprotected void showFontGlyph(Matrix textRenderingMatrix, PDFont font, int code, String unicode, Vector displacement) throws IOException
PDFStreamEngineshowFontGlyph in class PDFStreamEnginetextRenderingMatrix - the current text rendering matrix, Trmfont - the current fontcode - internal PDF character code for the glyphunicode - the Unicode text for this glyph, or null if the PDF does provide itdisplacement - the displacement (i.e. advance) of the glyph in text spaceIOException - if the glyph cannot be processedpublic void appendRectangle(Point2D p0, Point2D p1, Point2D p2, Point2D p3)
PDFGraphicsStreamEngineappendRectangle in class PDFGraphicsStreamEnginepublic void strokePath()
throws IOException
PDFGraphicsStreamEnginestrokePath in class PDFGraphicsStreamEngineIOException - If there is an IO error while stroking the path.public void fillPath(int windingRule)
throws IOException
PDFGraphicsStreamEnginefillPath in class PDFGraphicsStreamEnginewindingRule - The winding rule this path will use.IOExceptionpublic void fillAndStrokePath(int windingRule)
throws IOException
fillAndStrokePath in class PDFGraphicsStreamEnginewindingRule - The winding rule this path will use.IOException - If there is an IO error while filling the path.public void clip(int windingRule)
PDFGraphicsStreamEngineclip in class PDFGraphicsStreamEnginewindingRule - The winding rule which will be used for clipping.public void moveTo(float x,
float y)
PDFGraphicsStreamEnginemoveTo in class PDFGraphicsStreamEnginepublic void lineTo(float x,
float y)
PDFGraphicsStreamEnginelineTo in class PDFGraphicsStreamEnginepublic void curveTo(float x1,
float y1,
float x2,
float y2,
float x3,
float y3)
PDFGraphicsStreamEnginecurveTo in class PDFGraphicsStreamEnginepublic Point2D getCurrentPoint()
PDFGraphicsStreamEnginegetCurrentPoint in class PDFGraphicsStreamEnginepublic void closePath()
PDFGraphicsStreamEngineclosePath in class PDFGraphicsStreamEnginepublic void endPath()
PDFGraphicsStreamEngineendPath in class PDFGraphicsStreamEnginepublic void drawImage(PDImage pdImage) throws IOException
PDFGraphicsStreamEnginedrawImage in class PDFGraphicsStreamEnginepdImage - The image to draw.IOExceptionpublic void shadingFill(COSName shadingName) throws IOException
PDFGraphicsStreamEngineshadingFill in class PDFGraphicsStreamEngineshadingName - The name of the Shading Dictionary to use for this fill instruction.IOExceptionpublic void showAnnotation(PDAnnotation annotation) throws IOException
PDFStreamEngineshowAnnotation in class PDFStreamEngineannotation - An annotation on the current page.IOException - If an error occurred reading the annotationpublic void showTransparencyGroup(PDTransparencyGroup form) throws IOException
PDFStreamEngineshowTransparencyGroup in class PDFStreamEngineform - transparency group (form) XObjectIOException - if the transparency group cannot be processedCopyright © 2002–2016 The Apache Software Foundation. All rights reserved.